You are on page 1of 3

clear all;

im = imread('Finger2.bmp');
W = 16;
gradientsigma = 1;
blocksigma = 3;
orientsmoothsigma = 3;
[rows,cols] = size(im);
sze = fix(6*gradientsigma); if ~mod(sze,2); sze = sze+1; end
f = fspecial('gaussian', sze, gradientsigma); % Generate Gaussian filter.
[fx,fy] = gradient(f);
% Gradient of Gausian.
Gx = filter2(fx, im);
Gy = filter2(fy, im);
Gxx = Gx.^2;
Gxy = Gx.*Gy;
Gyy = Gy.^2;
sze
f =
Gxx
Gxy
Gyy

= fix(6*blocksigma); if ~mod(sze,2); sze = sze+1; end


fspecial('gaussian', sze, blocksigma);
= filter2(f, Gxx); % Smoothed moments
= 2*filter2(f, Gxy);
= filter2(f, Gyy);

denom = sqrt(Gxy.^2 + (Gxx - Gyy).^2) + eps;


sin2theta1 = Gxy./denom;
% Sine and cosine of doubled angles
cos2theta1 = (Gxx-Gyy)./denom;
sze = fix(6*orientsmoothsigma); if ~mod(sze,2); sze = sze+1; end
f = fspecial('gaussian', sze, orientsmoothsigma);
cos2theta = filter2(f, cos2theta1); % Smoothed sine and cosine of
sin2theta = filter2(f, sin2theta1); % doubled angles
orientim = pi/2 + atan2(sin2theta,cos2theta)/2;
Imin = (Gyy+Gxx)/2 - (Gxx-Gyy).*cos2theta/2 - Gxy.*sin2theta/2;
Imax = Gyy+Gxx - Imin;
reliability = 1 - Imin./Imax;

% poin care ---A = zeros(size(orientim));


[r,c] = size(orientim)
for i = 1:W:r
for j = 1:W:c
if j+W-1 < c & i+W-1 < r
sin2theta_new(ceil(i/W),ceil(j/W)) = max(max(sin2theta(i:i+W-1,

j:j+W-1)));
end
end
end
% determine poincare
[rr cc] = size(sin2theta_new)
temp=[];
for i=3:rr-2
for j=3:cc-2
if sin2theta(i,j) ~= 0
i
j
temp =[temp,sin2theta_new(i-2,j-2:j+2),sin2theta_new(i-1:i+2,j+2)',sin2the
ta_new(i+2,j+1:j-2),sin2theta_new(i+1:i-2,j-2)'];
k = length(temp);
poincare = 0;
for m=1:k-1
dif = temp(m+1) - temp(m);
if dif <= -pi/2
dif = dif + pi;
elseif abs(dif) < pi/2
dif = dif;
else
dif = pi - dif;
end;
poincare = poincare + dif;
end;
temp = [];
poincare = poincare/(2*pi);
heMap(i,j) = poincare;
%
heMap = [heMap;difsum,i,j];
if poincare >= 0.4 & poincare <= 0.6
A(i,j) = 1;
elseif poincare >= -0.55 & poincare < -0.45
'hello'
A(i,j) = 2;
end;
end;
end
end;
max(max(heMap))
figure,imshow(im); hold on;
[mm nn] =size(A);
for i = 1:mm
for j = 1:nn
if(A(i,j)==1)
A(i,j)==255;
plot(i,j,'g+');
else
A(i,j) = 0;
end
end

end
title('A');

You might also like