Fincontours unexpected result [closed]

asked 2016-09-14 15:32:01 -0600

nAkS_G gravatar image

Hi, I have a binary image, and I though to use findconrours such it may help in feature extraction. After implementing findcontours, when I print len(contours), the answer was 132!

My expectation should be 1 as I only have one object in the image, but I don't know why?

Here I attach the image image description

I would appreciate any comments.

Thank you

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LorenaGdL
close date 2016-09-15 15:05:07.908501

Comments

2

.jpg is a compressed image format and therefore it introduces compression artifacts: if you inspect your image carefully, you will notice that it not only contains 255 pixels and 0 pixels, it also contain values such as 253, 254, 1, 2, etc. in the border area. Such values create small contours all over the image. Binarize your image (threshold()) after loading it, and try again.

LorenaGdL gravatar imageLorenaGdL ( 2016-09-14 17:12:11 -0600 )edit

Yes, it works!. Thanks a lot LorenaGdL

nAkS_G gravatar imagenAkS_G ( 2016-09-15 13:17:29 -0600 )edit