Image Processing Reference
In-Depth Information
the Cartesian definition given in Equation 5.74. According to this equation the displacement
vector is given by
γ (1, 0) = ω (θ ) - b (5.84)
The matrix T stores the co-ordinates of γ (1, 0). This matrix is expanded to accommodate
all the computed entries.
Code 5.11 shows the implementation of the gathering process of the GHT. In this case
we use the Cartesian definition in Equation 5.74. The co-ordinates of points given by
%Generalised Hough Transform
function GHT(inputimage,RTable)
%image size
[rows,columns]=size(inputimage);
%table size
[rowsT,h,columnsT]=size(RTable);
D=pi/rowsT;
%edges
[M,Ang]=Edges(inputimage);
M=MaxSupr(M,Ang);
%accumulator
acc=zeros(rows,columns);
%for each edge point
for x=1:columns
for y=1:rows
if(M(y,x)~=0)
phi=Ang(y,x);
i=round((phi+(pi/2))/D);
if(i==0) i=1; end;
for j=1:columnsT
if(RTable(i,1,j)==0 & RTable(i,2,j)==0)
j=columnsT; %no more entries
else
a0=x-RTable(i,1,j); b0=y-RTable (1, 2, j);
if(a0>0 & a0<columns & b0>0 & b0<rows)
acc(b0,a0)=acc(b0,a0)+1;
end
end
end
end %if
end %y
end %x
Code 5.11
Implementing the GHT
Search WWH ::




Custom Search