MATLAB Answers

Remove Small Circles from an Image

7 views (last 30 days)
Jared Joshi
Jared Joshi on 9 Jul 2020
Answered: Image Analyst on 9 Jul 2020
I'm having trouble removing the circular particals in this thresholded image. I know if I use imfindcircle function, it can identify where they are. The problem is that I don't know where to go from there. If there are any alternate ways to do this instead of imfindcircle, I am open to it.

  0 Comments

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 9 Jul 2020
You can fill the blobs and then check the circularity or the solidity with regionprops and keep only whatever ones meet your criteria.
mask = imfill(mask, 'holes');
[labeledImage, numBlobs] = bwlabel(mask);
% Measure circularity and solidity.
props = regionprops(labeledImage, 'Solidity', 'Area', 'Perimeter');
% Get each measurement into vectors.
circularities = [props.Perimeter] .^ 2 ./ (4 * pi * [props.Area]);
solidities = [props.Solidity];
% Define which properties we want to keep the blob.
keepers = circularities < 4 & solidities > 0.8; % Or whatever values work for you.
% Make a new mask with only the keeper blobs.
newMask = ismember(labeledImage, find(keepers));

  0 Comments

Sign in to comment.