Ask Your Question
0

approxPolyDP force number of vertice and get heuristic

asked 2017-10-09 10:41:02 -0600

carton99 gravatar image

Hi,

I would like to use approxPolyDP to recognition rectangle. I use normal documentation (see DOC ) for input parameter, here : my input is a contours of my shape. In easy cases that works fine and I have my 4 points of my rectangle.

But I would like set epsilon parameter in order to have alway 4 points (Infact I don't understand how to set epsilon for my case of rectangle recognition). For exemple if epsilon is too minimal there are more than 4 points, but is not clear if that depend of number of contour or others thing.

In addition I would like to know if they have a method to get a heuristic of probability to dertermine if my contour of shape is a rectangle.

Thx, Christophe

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-10-09 11:33:37 -0600

berak gravatar image

updated 2017-10-09 11:43:08 -0600

epsilon does not know anything about your wishes.

all it does is check, if the angle (between consecutive points) surpasses the value, you gave it, and based on that, remove points from the original contour.

the larger you make it, the more points will be removed, that's all there is to it.

(again, you can neither specify the number of points retained, nor the final "shape")

edit flag offensive delete link more

Comments

So if the need is to approximate a contour a 4 sided polygon, what would you suggest is the best approach?

PinkFloyded gravatar imagePinkFloyded ( 2018-12-28 06:48:05 -0600 )edit

^^ please read the answer above, again.

berak gravatar imageberak ( 2018-12-28 06:50:07 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-10-09 10:41:02 -0600

Seen: 1,721 times

Last updated: Oct 09 '17