Revision history [back]

opencv expects white blobs on black bg in your binary image, you have it the other way round.

you could invert the image:

binarayImage = ~binarayImage // short for bitwise_not()


before the findContours() call.

(you also do not need to clone() the image, that idea is a leftover from 2.4 code)

opencv expects white blobs on black bg in your binary image, you have it the other way round.

you could invert the image:

binarayImage = ~binarayImage ~binarayImage; // short for bitwise_not()


before the findContours() call.

(you also do not need to clone() the image, that idea is a leftover from 2.4 code)

opencv opencv's findContours() expects white blobs on black bg in your binary image,

you have it the other way round.

you could invert the round, so feed it an inverted image:

binarayImage = ~binarayImage; // short for bitwise_not()
findContours( ~binarayImage, ....


before the findContours() call.

(you also do not need to clone() the image, that idea is a leftover from 2.4 code)