Image Processing Reference
In-Depth Information
%Parameter Decomposition for the Hough Transform for Lines
function HTDLine(inputimage)
%image size
[rows,columns]=size(inputimage);
%accumulator
rmax=round(sqrt(rows^2+columns^2));
accro=zeros(rmax,1);
acct=zeros(180,1);
%image
for x=1:columns
for y=1:rows
if(inputimage(y,x)==0)
for Nx=x-2:x+2
for Ny=y-2:y+2
if(x~=Nx|y~=Ny)
if(Nx>0 & Ny>0 &Nx<columns &Ny<rows)
if(inputimage(Ny,Nx)==0)
if (Ny-y~=0)
t=atan((x-Nx)/(Ny-y)); %Equation (5.40)
else t=pi/2;
end
r=round(x*cos(t)+y*sin(t)); %Equation (5.28)
t=round((t+pi/2)*180/pi);
acct(t)=acct(t)+1;
if(r<rmax & r>0)
accro(r)=accro(r)+1;
end
end
end
end
end
end
end
end
end
Code 5.7
Implementation of the parameter space reduction for the Hough transform for lines
all the vectors trace a circle. The derivatives of Equation 5.41 with respect to θ
define the
first and second directional derivatives. That is,
() 1
0 + ( ) 0
() =
x
y
1
(5.43a)
Search WWH ::




Custom Search