Home > OS >  imfindcircles not finding obvious circle
imfindcircles not finding obvious circle

Time:09-25

I've tried the examples on the imfindcircles documentation which use much more complicated images and they worked fine. But in the following code which generates a perfect centered circle and attempts to find it with imfindcircles I get an empty result. I've been playing around with the parameters for imfindcircles, including ObjectPolarity, Sensitivity, and a radii range, but I've yet to get anything other than an empty result.

function annulusConvolve()
    function outputImg = generateCircle2(circleRadius)
        padding = 200;
        [xmesh, ymesh] = meshgrid(-circleRadius-padding:circleRadius padding, -circleRadius-padding:circleRadius padding);
    
        outputImg = zeros(size(xmesh));
    
        outputImg((xmesh.^2   ymesh.^2) < circleRadius^2) = 1;
    
   
    end

    testPicture = generateCircle2(200);
    figure;
    imshow(testPicture);
    centers = imfindcircles(testPicture,200)
end

CodePudding user response:

worked ok for me if you try your example with:

centers = imfindcircles(testPicture,[195 205],'Sensitivity',0.99)
  • Related