Image Processing Reference
In-Depth Information
Code 5.6 shows the implementation of the HT mapping for ellipses. The function
HTEllipse computes the centre parameters for an ellipse without rotation and with fixed
axis length given as arguments. Thus, the implementation uses a 2D accumulator. In
practice, in order to locate an ellipse it is necessary to try all potential values of axis length.
This is computationally impossible unless we limit the computation to a few values.
%Hough Transform for Ellipses
function HTEllipse(inputimage,a,b)
%image size
[rows,columns]=size(inputimage);
%accumulator
acc=zeros(rows,columns);
%image
for x=1:columns
for y=1:rows
if(inputimage(y,x)==0)
for ang=0:360
t=(ang*pi)/180;
x0=round(x-a*cos(t));
y0=round(y-b*sin(t));
if(x0<columns & x0>0 & y0<rows & y0>0)
acc(y0,x0)=acc(y0,x0)+1;
end
end
end
end
end
Code 5.6
Implementation of the Hough transform for ellipses
Figure 5.14 shows three examples of the application of the ellipse extraction process
described in Code 5.6 . The first example (Figure 5.14 (a)) illustrates the case of a perfect
ellipse in a synthetic image. The array in Figure 5.14 (d) shows a prominent peak whose
position corresponds to the centre of the ellipse. The examples in Figures 5.14 (b) and
5.14 (c) illustrate the use of the HT to locate a circular form when the image has an oblique
view. Each example was obtained by using a different threshold in the edge detection
process. Figure 5.14 (c) contains more noise data that in turn gives rise to more noise in the
accumulator. We can observe that there is more than one ellipse to be located in these two
figures. This gives rise to the other high values in the accumulator space. As with the earlier
examples for line and circle extraction, there is again scope for interpreting the accumulator
space, to discover which structures produced particular parameter combinations.
5.4.5
Parameter space decomposition
The HT gives the same (optimal) result as template matching and even though it is faster,
Search WWH ::




Custom Search