blobs filtering is not working

4 ビュー (過去 30 日間)
mW
mW 2015 年 2 月 10 日
回答済み: mW 2015 年 2 月 10 日
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

回答 (1 件)

mW
mW 2015 年 2 月 10 日
any ideas?

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by