I1=imread('finger.jpg');
I2=imread('finger.jpg');
I1=imresize(I1,[256 256]);
I2=imresize(I2,[256 256]);
%s1=serial('COM4', 'BaudRate', 9600);
%fopen(s1);
subplot(3,2,1);imshow(I1)
subplot(3,2,2);imshow(I2)
G1=rgb2gray(I1);
G2=rgb2gray(I2);
E1=edge(G1,'sobel');
E2=edge(G2,'sobel');
subplot(3,2,3);imshow(E1)
subplot(3,2,4);imshow(E2)
message1='images matched';
message2='images does not match';
%intialization of variables
matched_data = 0;
white_points = 0;
black_points = 0;
x=0;
y=0;
l=0;
m=0;
%for loop used for detecting black and white points in the picture.
for a = 1:1:256
for b = 1:1:256
if(E1(a,b)==1)
white_points = white_points+1;
else
black_points = black_points+1;
end
end
end
%for loop comparing the white (edge points) in the two pictures
for i = 1:1:256
for j = 1:1:256
if(E1(i,j)==1)&&(E2(i,j)==1)
matched_data = matched_data+1;
else
;
end
end
end
%calculating percentage matching.
total_data = white_points;
total_matched_percentage = (matched_data/total_data)*100;
p=total_matched_percentage ;
%fprintf(s1,p)
%fclose(s1)
%outputting the result of the system.
if(total_matched_percentage >= 90) %can add flexability at this point by reducing the amount of matching.
total_matched_percentage
message1
else
total_matched_percentage
message2
end