blobs filtering is not working

4 vues (au cours des 30 derniers jours)
mW
mW le 10 Fév 2015
Réponse apportée : mW le 10 Fév 2015
Using some examples in this forum , have put a script together. I like to keep some blobs and delete the rest. M is my gray scale image.
Part of my code is shown in below. When ran it, it left me one blob (one horz. line) in the image. It should leave me two blobs or two horizontal lines?. what is wrong? How to correct that?.
L = bwlabel(M,8);
mymeasures = regionprops(L, 'Area', 'BoundingBox');
bb = mymeasures.BoundingBox;
Keepers = (bb(4) <= 2 || bb(3) <= 2) %... etc .. more conditins to be added later;
keepersIndexes = find(Keepers );
keeperBlobsImage = ismember(L, keeperIndexes);
M(~keeperBlobsImage) = 0;
this prints me the two blobs (or two horz. lines) I want to see.
mymeasures = regionprops(L, 'Area', 'BoundingBox');
for n = 1 : length(mymeasures)
bb = mymeasures(k).BoundingBox;
if (bb(4) <= 2 || bb(3) <= 2)
fprintf('Blob #%d %d\n', n, mymeasures(n).Area);
end
end

Réponses (1)

mW
mW le 10 Fév 2015
any ideas?

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by