How can I remove some of the largest connected components from an image and save the new image?
3 次查看(过去 30 天)
显示 更早的评论
% uploading my image I=imread('washington.jpg') % converting it to binary II=rgb2gray(I); figure();imshow(II) BW=bwlabel(II,8);
% This commands choose connected components bigger than a threshold and show them in different images % but I want this CCs to be ommited from the main image and I don`t want to assign a threshold mannually for k=1:max(max(BW)) out=(BW==k); [i,j]=find(out~=0); if length(i)>500 figure();imshow(out2) end end
0 个评论
回答(2 个)
md mizan chowdhury
2017-9-14
how can i delete all connected components.
1 个评论
Image Analyst
2017-9-14
Easy. Simply set everything to zero
labeledImage(:) = 0;
Now all components are gone. But what good is this to you?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!