Finding circle in an image

3 次查看(过去 30 天)
Damian Wierzbicki
Damian Wierzbicki 2017-7-19
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.

回答(1 个)

Image Analyst
Image Analyst 2017-7-19
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);

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by