blobs filtering is not working

4 visualizaciones (últimos 30 días)
mW
mW el 10 de Feb. de 2015
Respondida: mW el 10 de Feb. de 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

Respuestas (1)

mW
mW el 10 de Feb. de 2015
any ideas?

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by