OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Mon, 21 Sep 2015 12:30:09 -0500Approximate contour with n-sided polygonhttp://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/
I have segmented a contour which can be approximated by a 5-sided polygon (a square with a corner broken off).
Is there a function that makes use of this information? I currently uses approxPolyDP, but that function only uses a maximal distance between the approximation and the contour and not the expected number of corners. Mon, 21 Sep 2015 09:25:21 -0500http://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/Comment by LBerger for <p>I have segmented a contour which can be approximated by a 5-sided polygon (a square with a corner broken off).
Is there a function that makes use of this information? I currently uses approxPolyDP, but that function only uses a maximal distance between the approximation and the contour and not the expected number of corners. </p>
http://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/?comment=71374#post-id-71374I don't understand problem with scale invariant because algorithm stop when side number is equal to 5 (4 in my example) . Of course if you want a square and add one corner it does not work.
In that case I think you have to write your own algorithm. If contour is a circle there is 4 answers is it?Mon, 21 Sep 2015 12:30:09 -0500http://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/?comment=71374#post-id-71374Comment by FooBar for <p>I have segmented a contour which can be approximated by a 5-sided polygon (a square with a corner broken off).
Is there a function that makes use of this information? I currently uses approxPolyDP, but that function only uses a maximal distance between the approximation and the contour and not the expected number of corners. </p>
http://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/?comment=71367#post-id-71367The detection is so far reliable, but giving a distance threshold feels wrong if I have a much better information (n=5) in my case that would be scale-invariant.Mon, 21 Sep 2015 10:30:48 -0500http://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/?comment=71367#post-id-71367Comment by LBerger for <p>I have segmented a contour which can be approximated by a 5-sided polygon (a square with a corner broken off).
Is there a function that makes use of this information? I currently uses approxPolyDP, but that function only uses a maximal distance between the approximation and the contour and not the expected number of corners. </p>
http://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/?comment=71365#post-id-71365Have you try to decrease distance in approxPolyDP [like this](http://answers.opencv.org/question/71309/how-to-get-the-corners-of-rectangle-shapes/)?Mon, 21 Sep 2015 10:21:22 -0500http://answers.opencv.org/question/71359/approximate-contour-with-n-sided-polygon/?comment=71365#post-id-71365