diff --git a/modules/gapi/include/opencv2/gapi/core.hpp b/modules/gapi/include/opencv2/gapi/core.hpp index d531330e9a..de595e3189 100644 --- a/modules/gapi/include/opencv2/gapi/core.hpp +++ b/modules/gapi/include/opencv2/gapi/core.hpp @@ -1275,8 +1275,8 @@ GAPI_EXPORTS std::tuple integral(const GMat& src, int sdepth = -1, i The function applies fixed-level thresholding to a single- or multiple-channel matrix. The function is typically used to get a bi-level (binary) image out of a grayscale image ( cmp functions could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large -values. There are several depths of thresholding supported by the function. They are determined by -depth parameter. +values. There are several types of thresholding supported by the function. They are determined by +type parameter. Also, the special values cv::THRESH_OTSU or cv::THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu's @@ -1292,17 +1292,17 @@ Output matrix must be of the same size and depth as src. @param src input matrix (@ref CV_8UC1, @ref CV_8UC3, or @ref CV_32FC1). @param thresh threshold value. @param maxval maximum value to use with the cv::THRESH_BINARY and cv::THRESH_BINARY_INV thresholding -depths. -@param depth thresholding depth (see the cv::ThresholdTypes). +types. +@param type thresholding type (see the cv::ThresholdTypes). @sa min, max, cmpGT, cmpLE, cmpGE, cmpLS */ -GAPI_EXPORTS GMat threshold(const GMat& src, const GScalar& thresh, const GScalar& maxval, int depth); +GAPI_EXPORTS GMat threshold(const GMat& src, const GScalar& thresh, const GScalar& maxval, int type); /** @overload -This function applicable for all threshold depths except CV_THRESH_OTSU and CV_THRESH_TRIANGLE +This function applicable for all threshold types except CV_THRESH_OTSU and CV_THRESH_TRIANGLE @note Function textual ID is "org.opencv.core.matrixop.thresholdOT" */ -GAPI_EXPORTS std::tuple threshold(const GMat& src, const GScalar& maxval, int depth); +GAPI_EXPORTS std::tuple threshold(const GMat& src, const GScalar& maxval, int type); /** @brief Applies a range-level threshold to each matrix element. diff --git a/modules/gapi/test/common/gapi_core_tests.hpp b/modules/gapi/test/common/gapi_core_tests.hpp index 74e9a06460..fab4f6bbbd 100644 --- a/modules/gapi/test/common/gapi_core_tests.hpp +++ b/modules/gapi/test/common/gapi_core_tests.hpp @@ -100,7 +100,7 @@ GAPI_TEST_FIXTURE(AddWeightedTest, initMatsRandU, FIXTURE_API(CompareMats), 1, c GAPI_TEST_FIXTURE(NormTest, initMatrixRandU, FIXTURE_API(CompareScalars,NormTypes), 2, cmpF, opType) GAPI_TEST_FIXTURE(IntegralTest, initNothing, <>, 0) -GAPI_TEST_FIXTURE(ThresholdTest, initMatrixRandU, FIXTURE_API(int), 1, tt) +GAPI_TEST_FIXTURE(ThresholdTest, initMatrixRandU, FIXTURE_API(int, cv::Scalar), 2, tt, maxval) GAPI_TEST_FIXTURE(ThresholdOTTest, initMatrixRandU, FIXTURE_API(int), 1, tt) GAPI_TEST_FIXTURE(InRangeTest, initMatrixRandU, <>, 0) GAPI_TEST_FIXTURE(Split3Test, initMatrixRandU, <>, 0) diff --git a/modules/gapi/test/common/gapi_core_tests_inl.hpp b/modules/gapi/test/common/gapi_core_tests_inl.hpp index fa53551bcc..7fb6bda33e 100644 --- a/modules/gapi/test/common/gapi_core_tests_inl.hpp +++ b/modules/gapi/test/common/gapi_core_tests_inl.hpp @@ -682,7 +682,6 @@ TEST_P(IntegralTest, AccuracyTest) TEST_P(ThresholdTest, AccuracyTestBinary) { cv::Scalar thr = initScalarRandU(50); - cv::Scalar maxval = initScalarRandU(50) + cv::Scalar(50, 50, 50, 50); cv::Scalar out_scalar; // G-API code ////////////////////////////////////////////////////////////// diff --git a/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp b/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp index 658bd1b53d..44f440dabd 100644 --- a/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp +++ b/modules/gapi/test/cpu/gapi_core_tests_cpu.cpp @@ -251,7 +251,10 @@ INSTANTIATE_TEST_CASE_P(ThresholdTestCPU, ThresholdTest, Values(-1), Values(CORE_CPU), Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, - cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV))); + cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV), + Values(cv::Scalar(0, 0, 0, 0), + cv::Scalar(100, 100, 100, 100), + cv::Scalar(255, 255, 255, 255)))); INSTANTIATE_TEST_CASE_P(ThresholdTestCPU, ThresholdOTTest, Combine(Values(CV_8UC1), diff --git a/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp b/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp index 6ec9e0c2a0..8bc967544e 100644 --- a/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp +++ b/modules/gapi/test/cpu/gapi_core_tests_fluid.cpp @@ -226,7 +226,10 @@ INSTANTIATE_TEST_CASE_P(ThresholdTestFluid, ThresholdTest, Values(CORE_FLUID), Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, - cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV))); + cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV), + Values(cv::Scalar(0, 0, 0, 0), + cv::Scalar(100, 100, 100, 100), + cv::Scalar(255, 255, 255, 255)))); INSTANTIATE_TEST_CASE_P(InRangeTestFluid, InRangeTest, Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1), diff --git a/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp b/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp index 6d5d50ff0e..5ee292a735 100644 --- a/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp +++ b/modules/gapi/test/gpu/gapi_core_tests_gpu.cpp @@ -234,7 +234,10 @@ INSTANTIATE_TEST_CASE_P(ThresholdTestGPU, ThresholdTest, Values(-1), Values(CORE_GPU), Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, - cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV))); + cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV), + Values(cv::Scalar(0, 0, 0, 0), + cv::Scalar(100, 100, 100, 100), + cv::Scalar(255, 255, 255, 255)))); INSTANTIATE_TEST_CASE_P(ThresholdTestGPU, ThresholdOTTest, Combine(Values(CV_8UC1),