Finding circle in an image
2 views (last 30 days)
Show older comments
Hi guys. I have an image ( attached ) and I'm trying to find the location of the centre of the hole ( circle ) that is apparent in that image. I've been using imfindcircles ( tried different sensitivities ) with no success, probably due to that light reflection ( ? ) that is visible in the hole. Can anyone propose how to resolve that issue ? Thank you.

0 Comments
Answers (1)
Image Analyst
on 19 Jul 2017
I'd try to zero out the bright stuff, then threshold and call regionprops() and compute the circularity. Here's a start:
mask = grayImage > 200;
grayImage(mask) = 0;
binaryImage = grayImage < 50; % or whatever works.
labeledImage = bwlabel(binaryImage);
props = regionprops(labeledImage, 'Area', 'Perimeter');
allAreas = [props.Area];
allPerims = [props.Perimeter];
circularities = allPerimeters .^ 2 ./ (4 * pi * allAreas);
roundBlobIndexes = find(circularities < 2);
roundBlobs = ismember(labeledImage, roundBlobIndexes);
imshow(roundBlobs);
0 Comments
See Also
Categories
Find more on Image Segmentation and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!