Eliminate small areas in a binary image

16 vues (au cours des 30 derniers jours)
Marlene
Marlene le 5 Jan 2012
Hi all,
I have several binary images with small , middle and large areas. I want to remove small areas and for this I used the bwareaopen function. But the small size of some areas in an image is the middle size areas of others images . I wanted eliminate small areas using as parameter of function bwareaopen the value of the minimum area. For this, I wrote this code:
STATS = regionprops(BW, 'Area'); allareas=[STATS.Area]; min_area=min(allareas); BW2=bwareaopen(BW,min_area+1);
But the statement "min_area=min(allareas);" gives the error: "Index exceeds matrix dimensions."
Can someone tell me why the error? And how can I eliminate small for all images automatically?

Réponse acceptée

Sean de Wolski
Sean de Wolski le 5 Jan 2012
That means you've accidentally defined min or bwareaopen as a variable before.
whos min
clear min
And rename the variable in the line that overwrites it.

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by