Removing small area from labeled image

조회 수: 1 (최근 30일)
Syahrul Niezam
Syahrul Niezam 2012년 1월 30일
I tried to execute this codes to remove small labeled area, but the result is not much change compared to original labeled image.
a=imread('image1_118.jpg');
subplot(2, 3, 1);
imshow(a);
b=im2bw(a, 0.45);
subplot(2, 3, 2);
imshow(b);
c=bwlabel(b, 8);
subplot(2, 3, 3);
imshow(c, []);
subplot(2, 3, 4);
[B,L] = bwboundaries(c);
imshow(L)
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'y', 'LineWidth', 2)
end
stats=regionprops(c, 'area');
num=size(stats);
for k=1:num
areas=stats(k).Area;
end
areas2=[stats.Area];
x=areas2<100;
y=find(x);
L=ismember(c, y);
d=bwlabel(L, 8);
subplot(2, 3, 5);
imshow(d, []);
This is the generated image result;
Is there any mistake or suggestion to improve the codes, especially the last part.I would like to remove the below the human image.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by