opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
78.14k stars 55.72k forks source link

imgproc: C-API cleanup, drawContours refactor #25564

Closed mshabunin closed 4 months ago

mshabunin commented 4 months ago

Changes:

Note:

There is one case where old drawContours behavior doesn't match the new one - when contourIdx == -1 (means "draw all contours") and maxLevel == 0 (means draw only selected contours, but not what is inside).

From the docs:

contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.

Old behavior - only one first contour is drawn: actual_screenshot_08 05 2024

New behavior (also expected by the test) - all contours are drawn: expected_screenshot_08 05 2024

mshabunin commented 4 months ago

For some reason ABI verification has failed on buildbot, it complains two function has been removed: https://pullrequest.opencv.org/buildbot/builders/precommit_linux64/builds/107321/steps/Compare%20ABI%20dumps/logs/report-html

The problem is related to the changes in this PR, but I'm not sure if this is a severe issue.

opencv-alalek commented 4 months ago

ABI check has been updated.