gapi_imgproc_tests.hpp 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. //
  5. // Copyright (C) 2018-2020 Intel Corporation
  6. #ifndef OPENCV_GAPI_IMGPROC_TESTS_HPP
  7. #define OPENCV_GAPI_IMGPROC_TESTS_HPP
  8. #include <iostream>
  9. #include "gapi_tests_common.hpp"
  10. namespace opencv_test
  11. {
  12. // Create new value-parameterized test fixture:
  13. // Filter2DTest - fixture name
  14. // initMatrixRandN - function that is used to initialize input/output data
  15. // FIXTURE_API(CompareMats,int,int) - test-specific parameters (types)
  16. // 3 - number of test-specific parameters
  17. // cmpF, kernSize, borderType - test-specific parameters (names)
  18. //
  19. // We get:
  20. // 1. Default parameters: int type, cv::Size sz, int dtype, getCompileArgs() function
  21. // - available in test body
  22. // 2. Input/output matrices will be initialized by initMatrixRandN (in this fixture)
  23. // 3. Specific parameters: cmpF, kernSize, borderType of corresponding types
  24. // - created (and initialized) automatically
  25. // - available in test body
  26. // Note: all parameter _values_ (e.g. type CV_8UC3) are set via INSTANTIATE_TEST_CASE_P macro
  27. GAPI_TEST_FIXTURE(Filter2DTest, initMatrixRandN, FIXTURE_API(CompareMats,cv::Size,int), 3,
  28. cmpF, filterSize, borderType)
  29. GAPI_TEST_FIXTURE(BoxFilterTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
  30. cmpF, filterSize, borderType)
  31. GAPI_TEST_FIXTURE(SepFilterTest, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, kernSize)
  32. GAPI_TEST_FIXTURE(BlurTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
  33. cmpF, filterSize, borderType)
  34. GAPI_TEST_FIXTURE(GaussianBlurTest, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, kernSize)
  35. GAPI_TEST_FIXTURE(MedianBlurTest, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, kernSize)
  36. GAPI_TEST_FIXTURE(ErodeTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
  37. cmpF, kernSize, kernType)
  38. GAPI_TEST_FIXTURE(Erode3x3Test, initMatrixRandN, FIXTURE_API(CompareMats,int), 2,
  39. cmpF, numIters)
  40. GAPI_TEST_FIXTURE(DilateTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
  41. cmpF, kernSize, kernType)
  42. GAPI_TEST_FIXTURE(Dilate3x3Test, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, numIters)
  43. GAPI_TEST_FIXTURE(MorphologyExTest, initMatrixRandN, FIXTURE_API(CompareMats,cv::MorphTypes),
  44. 2, cmpF, op)
  45. GAPI_TEST_FIXTURE(SobelTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int,int), 4,
  46. cmpF, kernSize, dx, dy)
  47. GAPI_TEST_FIXTURE(SobelXYTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int,int,int), 5,
  48. cmpF, kernSize, order, border_type, border_val)
  49. GAPI_TEST_FIXTURE(LaplacianTest, initMatrixRandN,
  50. FIXTURE_API(CompareMats,int,double,int), 4,
  51. cmpF, kernSize, scale, borderType)
  52. GAPI_TEST_FIXTURE(BilateralFilterTest, initMatrixRandN,
  53. FIXTURE_API(CompareMats,int,double,double,int), 5,
  54. cmpF, d, sigmaColor, sigmaSpace, borderType)
  55. GAPI_TEST_FIXTURE(EqHistTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  56. GAPI_TEST_FIXTURE(CannyTest, initMatrixRandN, FIXTURE_API(CompareMats,double,double,int,bool), 5,
  57. cmpF, thrLow, thrUp, apSize, l2gr)
  58. GAPI_TEST_FIXTURE_SPEC_PARAMS(GoodFeaturesTest,
  59. FIXTURE_API(CompareVectors<cv::Point2f>,std::string,int,int,double,
  60. double,int,bool),
  61. 8, cmpF, fileName, type, maxCorners, qualityLevel, minDistance,
  62. blockSize, useHarrisDetector)
  63. GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursNoOffsetTest,
  64. FIXTURE_API(cv::Size,MatType2,cv::RetrievalModes,
  65. cv::ContourApproximationModes, CompareMats),
  66. 5, sz, type, mode, method, cmpF)
  67. GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursOffsetTest, <>, 0)
  68. GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursHNoOffsetTest,
  69. FIXTURE_API(cv::Size,MatType2,cv::RetrievalModes,
  70. cv::ContourApproximationModes, CompareMats),
  71. 5, sz, type, mode, method, cmpF)
  72. GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursHOffsetTest, <>, 0)
  73. GAPI_TEST_FIXTURE(BoundingRectMatTest, initNothing, FIXTURE_API(CompareRects,bool),
  74. 2, cmpF, initByVector)
  75. GAPI_TEST_FIXTURE(BoundingRectVector32STest, initNothing, FIXTURE_API(CompareRects), 1, cmpF)
  76. GAPI_TEST_FIXTURE(BoundingRectVector32FTest, initNothing, FIXTURE_API(CompareRects), 1, cmpF)
  77. GAPI_TEST_FIXTURE(FitLine2DMatVectorTest, initMatByPointsVectorRandU<cv::Point_>,
  78. FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
  79. GAPI_TEST_FIXTURE(FitLine2DVector32STest, initNothing,
  80. FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
  81. GAPI_TEST_FIXTURE(FitLine2DVector32FTest, initNothing,
  82. FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
  83. GAPI_TEST_FIXTURE(FitLine2DVector64FTest, initNothing,
  84. FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
  85. GAPI_TEST_FIXTURE(FitLine3DMatVectorTest, initMatByPointsVectorRandU<cv::Point3_>,
  86. FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
  87. GAPI_TEST_FIXTURE(FitLine3DVector32STest, initNothing,
  88. FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
  89. GAPI_TEST_FIXTURE(FitLine3DVector32FTest, initNothing,
  90. FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
  91. GAPI_TEST_FIXTURE(FitLine3DVector64FTest, initNothing,
  92. FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
  93. GAPI_TEST_FIXTURE(BGR2RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  94. GAPI_TEST_FIXTURE(RGB2GrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  95. GAPI_TEST_FIXTURE(BGR2GrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  96. GAPI_TEST_FIXTURE(RGB2YUVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  97. GAPI_TEST_FIXTURE(BGR2I420Test, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  98. GAPI_TEST_FIXTURE(RGB2I420Test, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  99. GAPI_TEST_FIXTURE(I4202BGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  100. GAPI_TEST_FIXTURE(I4202RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  101. GAPI_TEST_FIXTURE(YUV2RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  102. GAPI_TEST_FIXTURE(YUV2GrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  103. GAPI_TEST_FIXTURE(NV12toRGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  104. GAPI_TEST_FIXTURE(NV12toBGRpTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  105. GAPI_TEST_FIXTURE(NV12toRGBpTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  106. GAPI_TEST_FIXTURE(NV12toBGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  107. GAPI_TEST_FIXTURE(NV12toGrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  108. GAPI_TEST_FIXTURE(RGB2LabTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  109. GAPI_TEST_FIXTURE(BGR2LUVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  110. GAPI_TEST_FIXTURE(LUV2BGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  111. GAPI_TEST_FIXTURE(BGR2YUVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  112. GAPI_TEST_FIXTURE(YUV2BGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  113. GAPI_TEST_FIXTURE(RGB2HSVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  114. GAPI_TEST_FIXTURE(BayerGR2RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  115. GAPI_TEST_FIXTURE(RGB2YUV422Test, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
  116. GAPI_TEST_FIXTURE(ResizeTest, initNothing, FIXTURE_API(CompareMats,int,cv::Size), 3,
  117. cmpF, interp, sz_out)
  118. GAPI_TEST_FIXTURE(ResizePTest, initNothing, FIXTURE_API(CompareMats,int,cv::Size), 3,
  119. cmpF, interp, sz_out)
  120. GAPI_TEST_FIXTURE(ResizeTestFxFy, initNothing, FIXTURE_API(CompareMats,int,double,double), 4,
  121. cmpF, interp, fx, fy)
  122. } // opencv_test
  123. #endif //OPENCV_GAPI_IMGPROC_TESTS_HPP