Hi there i have a polygon problem. I don't know what to look for so i decided to ask here. The image below shows a simple shape. The contours are detected with OpenCV's findContours() and aproximated by the CV_CHAIN_APPROX_TC89_KCOS (for those who want to know how this is done) algorithm, so that all points in a line, are summarized to a single line. So anyways some contours contain some sort of, i call it noise, in the shape. The image below shows what is meant with noise. The red line is the contour. (Sorry no ms paint skills)
My goal is to redefine the shape to approximate the shape, but leave out this "noise". So the contour should look like this. The blue line shows the corrected contour.
cvGoodFeatuersToTrack()
....but have a criteria that corners should be separated by a good amount of distance...if corners form a cluster discard them.I can propose one more approach:
1)You can use Hough Line Transform to detect lines on your image (before use Canny to detect contours). You can not take into consideration small lines by using rather big threshold (the minimum number of intersections to “detect” a line) in method HoughLinesP.
2) After finding all lines you can find their intersection as it is described here by @DanielHsH. So you will be able to find all corners.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With