Merge pull request #12949 from AsyaPronina:missed_multiply_operator_for_GMAT

Made scale parameter optional for mul kernel wrapper (#12949)

* Added missed operator*(GMat, GMat). Made scale parameter optional for mul kernel.

* Fixed perf test for mul(GMat, GMat) kernel

* Removed operator*(GMat, GMat) as not needed
pull/13001/head
AsyaPronina 6 years ago committed by Alexander Alekhin
parent 6e3ea8b49d
commit 08536943ad
  1. 2
      modules/gapi/include/opencv2/gapi/core.hpp
  2. 4
      modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp
  3. 8
      modules/gapi/test/common/gapi_operators_tests.hpp

@ -581,7 +581,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
@param ddepth optional depth of the output matrix.
@sa add, sub, div, addWeighted
*/
GAPI_EXPORTS GMat mul(const GMat& src1, const GMat& src2, double scale, int ddepth = -1);
GAPI_EXPORTS GMat mul(const GMat& src1, const GMat& src2, double scale = 1.0, int ddepth = -1);
/** @brief Multiplies matrix by scalar.

@ -201,11 +201,11 @@ PERF_TEST_P_(MulPerfTest, TestPerformance)
initMatsRandU(type, sz, dtype, false);
// OpenCV code ///////////////////////////////////////////////////////////
cv::multiply(in_mat1, in_mat2, out_mat_ocv, dtype);
cv::multiply(in_mat1, in_mat2, out_mat_ocv, 1.0, dtype);
// G-API code ////////////////////////////////////////////////////////////
cv::GMat in1, in2, out;
out = cv::gapi::mul(in1, in2, dtype);
out = cv::gapi::mul(in1, in2, 1.0, dtype);
cv::GComputation c(GIn(in1, in2), GOut(out));
// Warm-up graph engine:

@ -149,11 +149,11 @@ g_api_ocv_pair_mat_mat opPlusM = {std::string{"operator+"},
[](cv::GMat in1,cv::GMat in2){return in1+in2;},
[](const cv::Mat& in1, const cv::Mat& in2, cv::Mat& out){cv::add(in1, in2, out);}};
g_api_ocv_pair_mat_mat opMinusM = {std::string{"operator-"},
[](cv::GMat in,cv::GMat c){return in-c;},
[](const cv::Mat& in, const cv::Mat& c, cv::Mat& out){cv::subtract(in, c, out);}};
[](cv::GMat in,cv::GMat in2){return in-in2;},
[](const cv::Mat& in, const cv::Mat& in2, cv::Mat& out){cv::subtract(in, in2, out);}};
g_api_ocv_pair_mat_mat opDivM = {std::string{"operator/"},
[](cv::GMat in,cv::GMat c){return in/c;},
[](const cv::Mat& in, const cv::Mat& c, cv::Mat& out){cv::divide(in, c, out);}};
[](cv::GMat in,cv::GMat in2){return in/in2;},
[](const cv::Mat& in, const cv::Mat& in2, cv::Mat& out){cv::divide(in, in2, out);}};
g_api_ocv_pair_mat_mat opGreater = {std::string{"operator>"},
[](cv::GMat in1,cv::GMat in2){return in1>in2;},
[](const cv::Mat& in1, const cv::Mat& in2, cv::Mat& out){cv::compare(in1, in2, out, cv::CMP_GT);}};

Loading…
Cancel
Save