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 Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by