Image Processing Reference
In-Depth Information
%Parameter Decomposition for the Hough Transform for Circles
function HTDCircle(inputimage)
%image size
[rows,columns]=size(inputimage);
%accumulator
acc=zeros(rows,columns);
%gather evidence
for x1=1:columns
for y1=1:rows
if(inputimage(y1,x1)==0)
for x2=x1-12:x1+12
for y2=y1-12:y1+12
if(abs(x2-x1)>10|abs(y2-y1)>10)
if(x2>0 & y2>0 & x2<columns & y2<rows)
if(inputimage(y2,x2)==0)
xm=(x1+x2)/2; ym=(y1+y2)/2;
if(y2-y1~=0) m=((x2-x1)/(y2-y1));
else m=99999999;
end
if(m>-1 & m<1)
for x0=1:columns
y0=round(ym+m*(xm-x0));
if(y0>0 & y0<rows)
acc(y0,x0)=acc(y0,x0)+1;
end
end
else
for y0=1:rows
x0=round(xm+(ym-y0)/m);
if(x0>0 & x0<columns)
acc(y0,x0)=acc(y0,x0)+1;
end
end
end
end
end
end
end
end
end
end
end
Code 5.8
Parameter space reduction for the Hough transform for circles
Search WWH ::




Custom Search