Assume we have some data points in an image which are perhaps the result of an edge detection process, or boundary points of a binary blob. We wish to recognise the points that form a straight line.
Consider a point (xi, yi) in the image. The general equation of a line is
y = ax + b.
There are infinitely many lines that pass through this point, but they all satisfy the conditionyi = axi + b
for varying a and b.We can rewrite this equation as
b = -xia + yi,
and plot the variation of a and b.If we divide parameter space into a number of discrete accumulator cells we can collect `votes' in a b space from each data point in x y space. Peaks in a b space will mark the equations of lines of co-linear points in x y space.
However, we have a problem with using y = ax + b to represent lines when the line is vertical. In that case and our parameter space is unbounded (we would need a very large computer to store our parameter accumulator array!)
An alternative representation of a line is given by
where r is the distance of the line from the origin and theta is the angle between this perpendicular and the x-axis. Our parameter space is now in and r, where and r is limited by the size of the image.As before, peaks in the accumulator array mark the equations of significant lines.
In theory any kind of curve can be detected if you can express it as a function of the form
For example a circle can be represented as(x - a)2 + (y - b)2 - r2 = 0.
One then has to work in n dimensional parameter space (three dimensional space for a circle).This model has three parameters: two parameters for the centre of the circle and one parameter for the radius of the circle. If the gradient angle for the edges is available, then this provides a constraint that reduces the number of degrees of freedom and hence the required size of the parameter space. The direction of the vector from the centre of the circle to each edge point is determined by the gradient angle, leaving the value of the radius as the only unknown parameter.
Thus, the parametric equations for a circle in polar coordinates are
|
|
|
|
|
|