imfindcircles does not detect obvious circles

12 visualizzazioni (ultimi 30 giorni)
Yannick Hauswirth
Yannick Hauswirth il 23 Set 2020
Risposto: Jalaj Gambhir il 1 Ott 2020
I try to use the function imfindcircles to detect circlesly in an image. To try it out I used the attached test image.
The used code can be seen here:
layer = imread("test1.png");
if size(layer,3)>1
layer = rgb2gray(layer); %if layer is a rgb image turn into grayscale
end
imshow(layer);
[centers, radii] = imfindcircles(layer,[10 2000],'ObjectPolarity','dark', 'Sensitivity',0.9)
viscircles(centers, radii,'Color','b');
I followed the principles of the following Mathworks guide:
In my opinion this should be super easy. There is a big, perfectly circular structure in the top of the shape. Still, the circle is not detected. I varried ObjectPolarity, Sensitivity, and the radii but nothing helped. Contrast also can't be the issue.
Is there something obvious that I'm missing why the circle is not detected?

Risposte (1)

Jalaj Gambhir
Jalaj Gambhir il 1 Ott 2020
Hi,
I think it is probably because the circle you want to detect is almost a semi circle (like only half of the circle is visible). A workaround could be to increase sensitivity and min. radius that you want to detect.
You can try:
[centers, radii] = imfindcircles(layer,[80 2000],'ObjectPolarity','dark', 'Sensitivity',0.99);
viscircles(centers, radii,'Color','b');
This works fine.
Hope this helps!

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by