Merge pull request #15570 from smirnov-alexey:gapi_threshold_test

pull/15591/head
Alexander Alekhin 5 years ago
commit 2fef9bc1d8
  1. 14
      modules/gapi/include/opencv2/gapi/core.hpp
  2. 2
      modules/gapi/test/common/gapi_core_tests.hpp
  3. 1
      modules/gapi/test/common/gapi_core_tests_inl.hpp
  4. 5
      modules/gapi/test/cpu/gapi_core_tests_cpu.cpp
  5. 5
      modules/gapi/test/cpu/gapi_core_tests_fluid.cpp
  6. 5
      modules/gapi/test/gpu/gapi_core_tests_gpu.cpp

@ -1275,8 +1275,8 @@ GAPI_EXPORTS std::tuple<GMat, GMat> 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<GMat, GScalar> threshold(const GMat& src, const GScalar& maxval, int depth);
GAPI_EXPORTS std::tuple<GMat, GScalar> threshold(const GMat& src, const GScalar& maxval, int type);
/** @brief Applies a range-level threshold to each matrix element.

@ -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)

@ -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 //////////////////////////////////////////////////////////////

@ -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),

@ -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),

@ -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),

Loading…
Cancel
Save