1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #18510 from OrestChura:oc/boundingRect

[G-API]: findContours() and boundingRect() Standard Kernels Implementation

* Add findContours() standard kernel
 - API and documentation provided:
   - as OpenCV provides two overloads whether to calculate hierarchy or not, but they differ by only the output in sight of G-API, two different G-API functions and kernels implemented
   - G-API Imgproc documentation divided into more parts according to imgproc module parts
   - some typos connected with division into parts corrected
 - `GArray<GArray<U>>` overload for `get_out` function provided to coonvert correctly into `vector<vector<U>>`
 - OCV backend supported
 - accuracy tests provided

* Add boundingRect() standard kernel
     - API and documentation provided:
       - GOpaque<Rect> used as an output
       - as OpenCV provides two possibilities whether to take a gray-scale image or a set of 2D points (`Point2i` or `Point2f` supported), three different overloads of a single G-API function and three kernels implemented
          - for a gray-scale image the overload via `GMat`
          - for a set of `Point2i` - the one via GArray<`Point2i`>
          - set of `Point2f` -> GArray<`Point2f`>
     - OCV backend supported
     - accuracy tests provided
       - comparison function for Rects provided
     - some typos in `gapi_tests_common` corrected

* Fix precommit windows warnings

* - Addressing comments:
   - split tests
 - Fix Windows warnings

* Static_cast for warnings

* - Remove randomness
 - Fix unnecessary precision losses

* - Forgot reference for RNG

* addressing comments

* equalizeHist -> no group

* `const` addedin new functions

* Address suggestions:
 - Hierarchical -> H
 - added cv::GMatDesc::isVectorPoins()
 - added support of giving a set of points to boundingRect()

* Addressing comments
 - IoU comparison function added for Rects
 - isPointsVector moved from a GMatDesc method to a separate function in imgproc.hpp
 - enums instead of int
 - typos corrected

* Addressing comments
 - findContours: Point offset -> GOpaque<Point>
 - removed "straight" comparison for Rects, IoU available only
 - changed vectors initialization -> fix Debug test run
 - Some typos

* added comment for later upgrades

* Fix not to corrupt docs by FIXME

* Addressing commens
 - overload without offset added (as a temporary workaround)
 - checkMetaForFindingContours -> validateFindingContoursMeta
 - added ostream overload for enums used in tests
This commit is contained in:
Orest Chura
2020-11-11 15:13:10 +03:00
committed by GitHub
parent ef32d7fd16
commit 3fc1c73064
8 changed files with 821 additions and 14 deletions
@@ -265,6 +265,78 @@ INSTANTIATE_TEST_CASE_P(GoodFeaturesInternalTestCPU, GoodFeaturesTest,
Values(3),
Values(true)));
INSTANTIATE_TEST_CASE_P(FindContoursNoOffsetTestCPU, FindContoursNoOffsetTest,
Combine(Values(IMGPROC_CPU),
Values(cv::Size(1280, 720)),
Values(CV_8UC1),
Values(RETR_EXTERNAL),
Values(CHAIN_APPROX_NONE)));
INSTANTIATE_TEST_CASE_P(FindContoursOffsetTestCPU, FindContoursOffsetTest,
Values(IMGPROC_CPU));
INSTANTIATE_TEST_CASE_P(FindContoursHNoOffsetTestCPU, FindContoursHNoOffsetTest,
Combine(Values(IMGPROC_CPU),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC1),
Values(RETR_EXTERNAL, RETR_LIST, RETR_CCOMP, RETR_TREE),
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS)));
INSTANTIATE_TEST_CASE_P(FindContoursHNoOffset32STestCPU, FindContoursHNoOffsetTest,
Combine(Values(IMGPROC_CPU),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_32SC1),
Values(RETR_CCOMP, RETR_FLOODFILL),
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS)));
INSTANTIATE_TEST_CASE_P(FindContoursHOffsetTestCPU, FindContoursHOffsetTest,
Values(IMGPROC_CPU));
INSTANTIATE_TEST_CASE_P(BoundingRectMatTestCPU, BoundingRectMatTest,
Combine(Values( CV_8UC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(-1),
Values(IMGPROC_CPU),
Values(IoUToleranceRect(0).to_compare_obj())));
INSTANTIATE_TEST_CASE_P(BoundingRectMatVector32STestCPU, BoundingRectMatVector32STest,
Combine(Values(-1),
Values(cv::Size(1280, 1),
cv::Size(128, 1)),
Values(-1),
Values(IMGPROC_CPU),
Values(IoUToleranceRect(0).to_compare_obj())));
INSTANTIATE_TEST_CASE_P(BoundingRectMatVector32FTestCPU, BoundingRectMatVector32FTest,
Combine(Values(-1),
Values(cv::Size(1280, 1),
cv::Size(128, 1)),
Values(-1),
Values(IMGPROC_CPU),
Values(IoUToleranceRect(1e-5).to_compare_obj())));
INSTANTIATE_TEST_CASE_P(BoundingRectVector32STestCPU, BoundingRectVector32STest,
Combine(Values(-1),
Values(cv::Size(1280, 1),
cv::Size(128, 1)),
Values(-1),
Values(IMGPROC_CPU),
Values(IoUToleranceRect(0).to_compare_obj())));
INSTANTIATE_TEST_CASE_P(BoundingRectVector32FTestCPU, BoundingRectVector32FTest,
Combine(Values(-1),
Values(cv::Size(1280, 1),
cv::Size(128, 1)),
Values(-1),
Values(IMGPROC_CPU),
Values(IoUToleranceRect(1e-5).to_compare_obj())));
INSTANTIATE_TEST_CASE_P(BGR2RGBTestCPU, BGR2RGBTest,
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),