Image Processing Reference
In-Depth Information
%Invariant Generalised Hough Transform
function GHTInv(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);
alfa=pi/4;
%accumulator
acc=zeros(rows,columns);
%for each edge point
for x=1:columns
for y=1:rows
if(M(y,x)~=0)
%search for the second point
x1=-1; y1=-1;
phi=Ang(y,x);
m=tan(phi-alfa);
if(m>-1 & m<1)
for i=3:columns
c=x+i;
j=round(m*(c-x)+y);
if(j>0 & j<rows & c>0 & c<columns & M(j,c)~=0)
x1=c; y1=j;
i=columns;
end
c=x-i;
j=round(m*(c-x)+y);
if(j>0 & j<rows & c>0 & c<columns & M(j,c)~=0)
x1=c; y1=j;
i=columns;
end
end
else
for j=3:rows
c=y+j;
i=round(x+(c-y)/m);
if(c>0 & c<rows & i>0 & i<columns & M(c,i)~=0)
x1=i; y1=c;
i=rows;
end