OpenCV - Can someone explain me in detail the findContours algorithm?

asked 2018-01-05 03:04:27 -0600

PoeteMaudit gravatar image

I am working with OpenCV and I am using the findContours function to detect the contours in an image. Because I wanted to learn more about the algorithm that this function uses, I downloaded the relevant research paper which is used by the software engineers of OpenCV for this. It is the following one: http://download.xuebalib.com/xuebalib...

I think that I understand in page 35 the marking policy which is the following:

(a) If the current following border is between the 0-component which contains the pixel (p, q + 1) and the 1-component which contains the pixel (p, q), change the value of the pixel (p, q) to -NBD.

(b) Otherwise, set the value of the pixel (p, q) to NBD unless (p, q) is on an already followed border.

But then I cannot understand in the example at page 37:

C:\fakepath\Paper.png

why at (a)-(b) the left ones (1) become twos (2) while the right ones (1) become minus twos (-2). In the same way, I cannot understand why at (b)-(c) the central ones (1) do not become minus threes (-3) but threes (3).

Can someone explain me this?

edit retag flag offensive close merge delete