Say we have the following contour information from OpenCV contours:
What I mean by a "region" is a subset of the contour with low directional variation.
So for example these, could be regions in the provided example:
One way to detect these could be, doing a local neighborhoud comparison of the dot products of the tangent at each point. (ie see how much the tangent changes locally).
I was wondering however if there is a better way to do this, using OpenCV directly rather than doing vector operations myself.
-When your region boundaries are always near-vertical or near-horizontal, consider preprocessing the image using a filter (erode, dilate), to isolate vertices and horices, then merge results, to find an alternating color on region boundaries.
-When your directions go anywhere, it's more complicated ! One option would be to retrieve coordinates from your pixels with the help of Hough lines see
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.