MATLAB Answers

imfindcircles giving the wrong center point co-ordinates

2 views (last 30 days)
Optical_Stress on 7 Apr 2017
I'm trying to run i'm findcircles to detect the (x,y) of the circle. My code is:
imageFile = [Directory,samples(2).name]; % Returns an image with a disk
SS = 0.89
R=[20 25]
imageFile=imread(imageFile); % Returns an array of the image
[centers, radii] = imfindcircles(imageFile,R,'ObjectPolarity','Bright','Method','TwoStage','Sensitivity',SS);
However, it returns the following output:
x y
855.256156864934 144.357353529456
864.922986956490 149.085194829211
These results are quite close, but they are not at the center. The radius is given. I plan on using the radius to then determine the the position of the disk within the image array (i.e. the grid of array values that represent the disk). This is an image:
I have already tried decreasing the sensitivity but this did not work. It doesn't matter what is done to the image so long as the correct center and radius (should be 22 pixels - this has come out fine) is determined.
I have created a loop to process multiple images. But it fails because imfindcircles returns more than one center value (they're also wrong) so the matrix fills up faster because i'm receiving more than 1 result per image. My other images contain circles where the black and white patterns on the circle are swapped.
Any ideas would be appreciated.


Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!