1 | initial version |
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)
2 | No.2 Revision |
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)
3 | No.3 Revision |
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)