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!