less connected pixels should be removed from image
조회 수: 2 (최근 30일)
이전 댓글 표시
here is a image having an object disk and a text so check the connectivty of pixels if the area having less connectivity should be removed like in this image text has less connecctivity so i have to remove the text
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156329/image.png)
댓글 수: 0
채택된 답변
Anand
2014년 2월 7일
Your definition of 'less connected' is not clear to me. However, if you want just the big round component, you can use regionprops to find the largest component and remove the smaller components using bwareaopen.
Here's an example:
% read image and convert to binary.
im = imread('http://www.mathworks.com/matlabcentral/answers/uploaded_files/7873/fake.png');
bw = logical(rgb2gray(im));
% use regionprops to find area of all components.
cc = regionprops(bw,'Area');
% find area of largest component.
maxarea = max([cc.Area]);
% use bwareaopen to remove smaller components.
out = bwareaopen(bw,maxarea);
Hope this helps!
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!