Hello, actually I am new to matlab and want to know how to remove some objects from a binary image based upon area. Such that when a particular threshold is set the components of image having area above threshold is removed. Like removing a large vessel of eye and not removing small ones. Is there any function??? Please provide assistance!

 채택된 답변

Dishant Arora
Dishant Arora 2014년 2월 19일
편집: Dishant Arora 2014년 2월 20일

0 개 추천

once you have got the binary image,you can do the following:
outputImage = xor(BW , bwareaopen(BW , threshArea));
% BW being the binary image
% it will discard objects with area greater then threshArea
imshow(outputImage)

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 2월 19일

1 개 추천

I just did that in the past month or two for someone - extracting the main vasculature of the retina in a fundus photograph. Look up the tag eye and look for my name. Or look in my File Exchange or at bwareaopen as Dishant suggests.

댓글 수: 6

Mohammed Farhan
Mohammed Farhan 2014년 2월 22일
Thank you very much for your help. Thanks Again!!!
Mohammed Farhan
Mohammed Farhan 2014년 2월 22일
If you don't mind Please can you say what do this mean : "MAs are 10-100 microns diameter in size, thus MAs can be identified from noise based on area. Two threshold values are decided by experimentation to remove noise objects having area greater and lower than MAs. What should I do in here ?
They're selecting regions based on the area. Look at my image segmentation tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. Here's the relevant snippet from the tutorial:
% Now I'll demonstrate how to select certain blobs based using the ismember function.
% Let's say that we wanted to find only those blobs
% with an intensity between 150 and 220 and an area less than 2000 pixels.
% This would give us the three brightest dimes (the smaller coin type).
allBlobIntensities = [blobMeasurements.MeanIntensity];
allBlobAreas = [blobMeasurements.Area];
% Get a list of the blobs that meet our criteria and we need to keep.
allowableIntensityIndexes = (allBlobIntensities > 150) & (allBlobIntensities < 220);
allowableAreaIndexes = allBlobAreas < 2000; % Take the small objects.
keeperIndexes = find(allowableIntensityIndexes & allowableAreaIndexes);
% Extract only those blobs that meet our criteria, and
% eliminate those blobs that don't meet our criteria.
% Note how we use ismember() to do this.
keeperBlobsImage = ismember(labeledImage, keeperIndexes);
Mohammed Farhan
Mohammed Farhan 2014년 2월 22일
Thank you very much! But I still get an error:
Undefined variable "blobMeasurements" or function "blobMeasurements.MeanIntensity".
Error in naew (line 118) allBlobIntensities = [blobMeasurements.MeanIntensity];
Please Help
Dishant Arora
Dishant Arora 2014년 2월 22일
편집: Dishant Arora 2014년 2월 22일
You need to call regionprops before running this snippet like:
blobMeasurements = regionprops(labeledImage,grayImage,'all');
or
blobmeasurements =regionprops(labelleImage,grayImage,'Area','MeanIntensity');

댓글을 달려면 로그인하십시오.

질문:

2014년 2월 19일

편집:

2014년 2월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by