Re-label a matrix after using bwlabel.
8 ビュー (過去 30 日間)
古いコメントを表示
Partners I have a question. I'm working on the division of a matrix by means connected regions using labels through bwlabel, but it turns out a high number of connected regions. I have tried to simplify calculating the area of the labels and if areas are lower than the a value they are eliminated.
[L, NUM] = bwlabel (M);
regionrops s = (L, 'Area');
y = [s.Area];
ind = find (y <10)
for j = 1:1959
for i = 1:199
for k = 1: length (ind)
if (L (i, j) == 0 | | L (i, j) == ind (k))
L (i, j) = 0
end
end
end
But when I delete the labels that meet the above condition. The matrix L is disordered. How can I order it?
if the pixels that do not meet the condition I put to one and next step I apply bwlabel, only a label has been removed. Is there any function that reorders labels in the matrix L?
Thanks and best regards
0 件のコメント
採用された回答
Image Analyst
2011 年 11 月 5 日
Yes, it's called intlut(). But why do you want to reorder the labels? Anyway, back to your first question, there are other ways of getting rid of blobs less than 10 pixels in size including bwareaopen() and ismember(). See my BlobsDemo in the File Exchange : http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Recognition, Object Detection, and Semantic Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!