How can I remove some of the largest connected components from an image and save the new image?

3 visualizaciones (últimos 30 días)
% 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

Respuestas (2)

md mizan chowdhury
md mizan chowdhury el 14 de Sept. de 2017
how can i delete all connected components.

Image Analyst
Image Analyst el 14 de Sept. de 2017
Use bwareaopen() or propfilt() or bwareafilt().

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by