How can you find circular blobs in an image?
8 views (last 30 days)
Show older comments
I am trying to find certain parts of an image, and so used the Canny edge detector. Now I want to get rid of all the edges that are not vaguely circular in shape. How can I remove them?
This is a sample image that I am trying to search.
0 Comments
Accepted Answer
Image Analyst
on 7 Feb 2016
Edited: Image Analyst
on 9 Feb 2016
What if the blob is shaped like a C or a G? Is that roughly circular? If so, you'll need to call bwconvhull() first. If not, you can look at the ration of perimeters square to areas
measurements = regionprops(binaryImage, 'Area', 'Perimeter');
allAreas = [measurements.Area];
allPerimeters = [measurements.Perimeter];
circularities = 4*pi*allAreas ./ allPerimeters^2;
round objects will have circularity values more than around 0.8 or so, or whatever value you want to go with.
6 Comments
Image Analyst
on 9 Feb 2016
If the blobs are all round, it might happen that some values are more than 1. If they are stick-like then the values should be low, like around 0 to 0.6 or so. I actually made a mistake and forgot to square the perimeter. I've now corrected it and the correct equation is also below:
circularities = 4*pi*allAreas ./ allPerimeters^2;
More Answers (0)
See Also
Categories
Find more on Feature Detection and Extraction in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!