Ask Your Question

Izzy88's profile - activity

2019-03-25 20:16:22 -0500 received badge  Popular Question (source)
2016-07-31 19:08:14 -0500 commented answer Does findContours create duplicates?

thank you, can you explain me what's the point of blurring the image? Is it something recommended in this case also when you work on more "complex" shapes?

2016-07-31 05:32:17 -0500 received badge  Scholar (source)
2016-07-31 05:32:14 -0500 received badge  Supporter (source)
2016-07-31 05:32:11 -0500 commented answer Does findContours create duplicates?

Thanks! Actually, I did what you suggested using the same sample image and also counting how many pixels were set to 1 (without repetitions). I ended up with having exactly 877 white pixels in the new Mat::zeros image. At this point, i think the result I get by using "findNonZero" is correct, accurate and in this case more efficient since I can avoid the double for loop I used for mapping the contour points for this test.

2016-07-30 14:06:29 -0500 asked a question Does findContours create duplicates?

Hi, I'm considering a binary image from which I extract its edges using cv::Canny. Consequently, I perform cv::findContours, storing all the contours points coordinates in a

vector < vector < Point > >


I noticed that the number of pixels (Points) in this structure is greater than the number of pixels I get by computing

vector<point> white_pixels;
findNonZero(silhouette, white_pixels);

on the same image.

Therefore I'm wondering if this happens because findContours includes duplicate points in its result or because findNonZero is less precise.

E.g. on a 200x200 sample image with the first method I get 1552 points while with the second I get 877.

In case the first hypothesis is correct, is there a way to either ignore the duplicates or remove them?