From: Elad Lachmi on
Hi all,
I`m trying my hand at implementing an algorithm for off-line signature verification.
One of the parameters used is the bassline slant angle.
I found this text in an artical:
"Baseline is the imaginary line about which the signature is assumed to rest. The angle of inclination of this line to the horizontal is called the Slant Angle. To determine the slant angle the ratio of the maximum horizontal projection to the width of the projection is maximized over a range of values of angle of rotation."

I translated it to the following code:

% A. Baseline Slant Angle calculation
%***************************************************

figure,imshow(it);
ang=-45:5:45;
it_backup=it;
for i=1:length(ang)
it_rotate=imrotate(it,ang(i),'loose');
for j=1:Y
P_H(j)=sum(it_rotate(:,j));
end
H_teta=max(P_H);
non_zero=find(P_H) ; %Find indices and values of nonzero elements
W_teta=length(non_zero);
ro_teta(i)=(H_teta)/(W_teta);
it=it_backup;
end
ro_max=max(ro_teta);
ro_max_indx=find(ro_teta==ro_max);
b_l_a=ang(ro_max_indx);
figure,imshow(imrotate(it,b_l_a,'loose'));

This is not working and it`s driving me nuts!
Any help will be very appreciated.

Thank you,
Elad.