Ask Your Question
1

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

asked 2020-04-02 10:58:13 -0500

TheCakeLover gravatar image

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 flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2020-04-02 11:53:56 -0500

crackwitz gravatar image

updated 2020-04-02 12:06:16 -0500

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:

image description image description image description

edit flag offensive delete link more

Comments

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 :)

TheCakeLover gravatar imageTheCakeLover ( 2020-04-02 12:02:21 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 64 times

Last updated: Apr 02