blobs filtering is not working
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!