How can I remove some of the largest connected components from an image and save the new image?
조회 수: 2 (최근 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에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!