Fastest Method to Loop Through Contour Pixels [closed]
I am looking for the fastest way to iterate through the pixels in a contour.
I am currently creating a new grayscale and then using the function cvDrawContours to fill in the contours pixels in the grayscale. Next, I loop through contours min area rectangle pixels skipping the pixels which are not filled in with the grayscale.
This seems a bit inefficient, is there a better method???
Hi,when you use cvDrawContours and you get contour pixels.so why do you oop through contours min area rectangle pixels skipping the pixels which are not filled in with the grayscale???
What you described is the method I am using. I was wondering if there was faster method than creating a grayscale mask from cvDrawContours to isolate a contours pixels.
hi,you mean like this findContours(image, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
for(;itContours != contours.end();++itContours)
{ ………………
}
as i know the loop is to get each contours of the shapes
Did you ever find a better way? I have the same issue, and believe this to be the bottleneck of my application :-/
Maybe first you should clear an isolated contours pixels for example if area size is less than constanst area then do not draw, and area size is larger than ,then do what you want.