less connected pixels should be removed from image

1 回表示 (過去 30 日間)
Filza Ashraf
Filza Ashraf 2014 年 2 月 7 日
回答済み: Filza Ashraf 2014 年 2 月 10 日
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

採用された回答

Anand
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!

その他の回答 (1 件)

Filza Ashraf
Filza Ashraf 2014 年 2 月 10 日
but i am not getting this on gray scale image it gives me a black and white image as an output how can i mask this out put to mu original image like this in MRI image i have to just remove the text area

Community Treasure Hunt

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

Start Hunting!

Translated by