Image Processing Reference
In-Depth Information
array in terms of θ and ρ , the parameters of interest. The advantage of this alternative
mapping is that the values of the parameters θ
and ρ
are now bounded to lie within a
specific range. The range for ρ
is within 180°
; the possible values of ρ
are given by the
image size, since the maximum length of the line is
N where N is the (square) image
size. The range of possible values is now fixed, so the technique is practicable.
The implementation of the polar HT for lines is the function HTPLine in Code 5.4. The
accumulator array is a set of 180 bins for value of θ
2 ,
in the range 0 to 180°
, and for values
2
2
of ρ
+ , where N × M is the picture size. Then, for image (edge)
points greater than a chosen threshold, the angle relating to the bin size is evaluated (as
radians in the range 0 to π ) and then the value of ρ is evaluated from Equation 5.28 and the
appropriate accumulator cell is incremented so long as the parameters are within range.
The accumulator arrays obtained by applying this implementation to the images in Figure
5.8 is shown in Figure 5.9. Figure 5.9 (a) shows that a single line defines a well-delineated
peak. Figures 5.9 (b) and 5.9 (c) show a clearer peak compared to the implementation of the
Cartesian parameterisation. This is because discretisation effects are reduced in the polar
parameterisation. This feature makes the polar implementation far more practicable than
the earlier, Cartesian, version.
in the range 0 to
NM
%Polar Hough Transform for Lines
function HTPLine(inputimage)
%image size
[rows,columns]=size(inputimage);
%accumulator
rmax=round(sqrt(rows^2+columns^2));
acc=zeros(rmax,180);
%image
for x=1:columns
for y=1:rows
if(inputimage(y,x)==0)
for m=1:180
r=round(x*cos((m*pi)/180)+y*sin(m*pi)/180));
if(r<rmax & r>0) acc(r,m)=acc(r,m)+1; end
end
end
end
end
Code 5.4
Implementation of the polar Hough transform for lines
5.4.3
HT for circles
The HT can be extended by replacing the equation of the curve in the detection process.
The equation of the curve can be given in explicit or parametric form. In explicit form, the
HT can be defined by considering the equation for a circle given by
Search WWH ::




Custom Search