From 08536943ad688e3d12bedd7d30ed3a303fbe241c Mon Sep 17 00:00:00 2001 From: AsyaPronina <155jj@mail.ru> Date: Tue, 30 Oct 2018 21:10:47 +0300 Subject: [PATCH] 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 --- modules/gapi/include/opencv2/gapi/core.hpp | 2 +- modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp | 4 ++-- modules/gapi/test/common/gapi_operators_tests.hpp | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/gapi/include/opencv2/gapi/core.hpp b/modules/gapi/include/opencv2/gapi/core.hpp index 9ee45deb1d..bdc7af6d39 100644 --- a/modules/gapi/include/opencv2/gapi/core.hpp +++ b/modules/gapi/include/opencv2/gapi/core.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. diff --git a/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp b/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp index d1b72e6b9a..ccf55eee53 100644 --- a/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp +++ b/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp @@ -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: diff --git a/modules/gapi/test/common/gapi_operators_tests.hpp b/modules/gapi/test/common/gapi_operators_tests.hpp index 37bed923a1..5a5a53fed4 100644 --- a/modules/gapi/test/common/gapi_operators_tests.hpp +++ b/modules/gapi/test/common/gapi_operators_tests.hpp @@ -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);}};