Is the function regionprops useful for counting small regions ?
Afficher commentaires plus anciens
Hello, I'm making a project with image processing. My new goal is to clear all the small pixels (noise).
I've found regionprops as a good tool that helped me throw the first part of my project.
During the second part of the project I've used the function:
BW = im2bw (image); % Saving as BW image
no_hole = imfill(BW,'holes'); % Filling holes
new = no_hole-BW; % See what was filled
region=regionprops(new,'Area'); % Count all the "holes filled"
object=sort([region.Area]); % Create a vector with size of "holes filled"
number=length(object) % Response to see the number of areas
My problem is that regionprops doesn't actually counts all my objects separately, he counts them all as if they were all together.
"number" is always storing 1. "Region" is saved as 1x1struct.
By the way here's the image: imshow (new)

In the counterpart I've tried to use bwlabel function to count the REAL number of objects, and he returned to me 100 different objects.
[L,num]=bwlabel(new);
Is the function regionprops usefull for counting small regions like 30 pixels inside a 1300x1600 picture ?
I'm trying to clear the small pixels with find, for and if functions, but I still can't find a way to clear my noisy pixels.
Thanks for your time,
Luiz Stipp
Réponse acceptée
Plus de réponses (1)
Luiz Felipe Fernandes Stipp
le 22 Juil 2020
Catégories
En savoir plus sur Graph and Network Algorithms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!