0
votes

I am detecting rectangle in an image using openCV. As in many examples, I use threshold+findContours+approxPolyDP.

As shown in image below, my problem is that the contours found by findContours don't continue, so after approxPolyDP, I can't get a rectangle...

So, do you have any idea how to solve this problem? Thank you. :)

Another question: why the contours are gray? After the thresholding, there should be only white and black, shouldn't there?

Contours

After approxPolyDP

1
becarefull in findcontours source image is modifiedLBerger

1 Answers

0
votes

C++: void approxPolyDP(InputArray curve, OutputArray approxCurve, double epsilon, bool closed)

epsilon – Parameter specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation.

try increasing epsilon