% bugfixed for houghf.c version 2002.10.05 http://www.gerox.com
% version up can apply non square image  version 2004.02.07 http://www.gerox.com
xmax=30;
ymax=50;
rhomax=200;
thetamax=180;
bw=eye(ymax,xmax);
xymax=sqrt(xmax^2+ymax^2);
bw=imrotate(bw,60,'crop');
close all;
figure(1)
imshow(bw)
hold on;
hline1=plot([1 1],[-xymax xymax],'linewidth',2);
hold off
drawnow;
c=houghf(bw,rhomax,thetamax);
figure(2)
imshow(c,[ ]);axis square;
set(2,'windowbuttondown',['aaa=get(gca,''currentpoint'');',...
'theta = pi/thetamax*(aaa(1,1)-1);',...
'rho = (rhomax/2-aaa(1,2))*xymax/rhomax;',...
'x=(rho/cos(theta)-(-[-xymax xymax]+ymax/2)*sin(theta)/cos(theta))+xmax/2+1;',...
'set(hline1,''Xdata'',x);',...
'drawnow;']);
set(1,'doublebuffer','on');
set(2,'doublebuffer','on');
