1

You are given a set of points {(X1,Y1), (X2,Y2),...} which represent a hand-drawn circle, so it's not perfect. You are asked to find the center and radius of this circle.

My intuition tells me this involves minimization, and I need to find the coefficients in a non-linear generalized least squares model. Am I not thinking of a simpler or more "proper" approach?

  • I posted a solution to a very similar question here. It will give you the least squares solution, which will be ideal for your case of a hand-drawn circle where lots of error will be present. – AnonSubmitter85 May 08 '14 at 18:28

2 Answers2

3

You can use a trick to make this a regular least-squares optimization, in an extension of the method for finding the center of a circle through three points. Draw a perpendicular bisector for every pair of points. If the points are all on a circle, they will all intersect at a common point; since it is an approximate circle, they will slightly miss each other. The squared distance to each line is a quadratic form, so the sum of the squared distances is also a quadratic form, and minimizing this is a least-squares problem. That's the center of the circle.

Given this, you can just find the radius as the mean of the distances of each point to the center.

  • 1
    Note that this method is probably a bit sensitive to fluctuations in the derivative around the edge, since two points at nearly the same angle but different radii will have a perpendicular bisector that completely misses the center. Thus you may want to ignore points that are too close together, if you have a lot of data. – Mario Carneiro May 08 '14 at 18:23
-1

For each point you are given, we assume that it satisfies the following relation:

$$ ( x_i - x_0 )^2 + ( y_i - y_0)^2 = r^2. $$

This can be written as

$$ \left[ \begin{array}{ccc} 1 & -2x_i & -2y_i \end{array} \right] \left[ \begin{array}{c} x_0^2 + y_0^2 -r^2 \\ x_0 \\ y_0 \end{array} \right] = -x_i^2 - y_i^2. $$

Thus, using all of the $(x_i,y_i)$ pairs, we can set up an over-determined system $\mathbf{Ax}=\mathbf{b}$. The least squares solution $\bar{\mathbf{x}}$ to this system will give you your answer.