MATLAB Answers

0

imfindcircles giving the wrong center point co-ordinates

Asked by Optical_Stress on 7 Apr 2017
Hi,
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]
imshow(imageFile)
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.

  0 Comments

Sign in to comment.

0 Answers