Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Remove small objects from binary image

Hello All,

I have an input binary image but with lot of unwanted particles which I want to remove small objects based on the area of the particles. image description

I have developed the code in MATLAB which works fine using bwareaopen function. image description

i came across connectedComponentsWithStats function which can help me solve my purpose, here is the section of my code: Mat labels, stats, centroids; connectedComponentsWithStats(inputbinaryimage, labels, stats, centroids, 8, CV_32S); Later I verified the area of particles using stats output array which successfully detects those particles. Now I'm stuck at how to use the STAT_AREA function to filter out unwanted particles. One more thing is that the input image will be changing(position of the particles wont be same for the next image) so I can't use compare function to filter out using labels.

Apart from connectedComponents are there any other functions which can perform the same operation much faster on the input binary image to get the desired output image.

Remove small objects from binary image

Hello All,

I have an input binary image but with lot of unwanted particles which I want to remove small objects based on the area of the particles. image description

I have developed the code in MATLAB which works fine using bwareaopen function. image description

i came across connectedComponentsWithStats function which can help me solve my purpose, here is the section of my code: code:

Mat labels, stats, centroids;
connectedComponentsWithStats(inputbinaryimage, labels, stats, centroids, 8, CV_32S);CV_32S);
 

Later I verified the area of particles using stats output array which successfully detects those particles. Now I'm stuck at how to use the STAT_AREA function to filter out unwanted particles. One more thing is that the input image will be changing(position of the particles wont be same for the next image) so I can't use compare function to filter out using labels.

Apart from connectedComponents are there any other functions which can perform the same operation much faster on the input binary image to get the desired output image.