Re-label a matrix after using bwlabel.

8 ビュー (過去 30 日間)
Cristina
Cristina 2011 年 11 月 5 日
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

採用された回答

Image Analyst
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
  2 件のコメント
Cristina
Cristina 2011 年 11 月 5 日
Thank you very much for your answers. But I have a problem with intlut . What second matriz (?) do I put in input? B=intlut(L,?)
My problem is that I have the matrix L I want to modify to L2
L= 1 1 0 0 y yo quiero que reorder in L2= 1 1 0 0
0 0 5 5 0 0 2 2
7 7 0 0 3 3 0 0
7 0 9 9 3 0 4 4
I want to do this because I have that extract features the different region that composed an image using regionprops. With bwlabel I have a lot of regions (more than 1000) and I have to simplify it to 20 features. This algorithm is to select exudates in fondus eyes images
Cristina
Cristina 2011 年 11 月 5 日
Pardon
L= [1 1 0 0;0 0 5 5; 7 7 00; 7 0 9 9]
and I want
L2= [1 1 0 0; 0 0 2 2; 3 3 0 0;4 0 5 5]

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRecognition, Object Detection, and Semantic Segmentation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by