# Is the output of approxPolyDP(c) a subset of the input contour c?

I'm determining corner points using an approximated version of contour c, then try to find the index of the found corner in the original contour using numpy.where(). But for some points no index can be found, meaning the point seems not to be in the original contour.

As I understand the underlying DP-algorithm, no new points are added, is that correct?

Cheers!

edit retag close merge delete

Sort by » oldest newest most voted

yes. approxPolyDP only removes points.

a consequence of this is that, if you have a rectangle with rounded/imperfect corners, you can't "recover" the true corners. whatever points remain after approxPolyDP will be points on the rounded corner.

a severe example with epsilon=5 and epsilon=10:

more

Thank you very much! May I follow up with a slightly unrelated question? As I have feared, my code has to be wrong at some other point...how would you recommend to get the index of a determined point in the original contour?

EDIT: found a solution to the problem :)

( 2020-04-02 12:02:21 -0500 )edit

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2020-04-02 10:57:38 -0500

Seen: 130 times

Last updated: Apr 02 '20