IMAGE MATCHING
ITS A TECHNIQUE TO COMPARE TO IMAGES BY COMPARING THERE WHITE PIXELS, THIS IS VERY USEFUL WHILE CALCULATING PERCENTAGE CHANGE IN SAME IMAGE CAPTURED AT DIFFERENT INTERVALS OF TIME.
These are the procedures to apply on the images captured to calculate the percentage match
Image1 |
Image2 |
CODE FOR IMAGE COMPARISON
<code>A=imread('Image1');
M=imread('Image2');
A=rgb2gray(A);
M=rgb2gray(M);
figure,imshow(A);
title('after gray conversion A');
figure,imshow(M);
title('after gray conversion M');
J=wiener2(A,[5 5]);
title('image after wiener filtering A');
figure,imshow(J);
J1=wiener2(M,[5 5]);
title('image after wiener filtering M');
figure,imshow(J1);
BW1=edge(J,'canny');
figure,imshow(BW1);
title('image after edge detection A');
BW2=edge(J1,'canny');
figure,imshow(BW2);
title('image after edge detection M');
OUTPUT_MESSAGE = 'almost same x-ray images ';
OUTPUT_MESSAGE2 = ' x-ray images not matching ';
matched_data = 0;
white_points1 = 0;
white_points2 = 0;
black_points = 0;
x=0;
y=0;
l=0;
m=0;
time=0;
for a = 1:1:300
for b = 1:1:300
if(BW1(a,b)==1)
white_points1 = white_points1+1;
else
black_points = black_points+1;
end
end
end
for a = 1:1:300
for b = 1:1:300
if(BW2(a,b)==1)
white_points2 = white_points2+1;
else
black_points = black_points+1;
end
end
end
display(white_points1);
display(white_points2);
%total_data = white_points;
total_matched_percentage = (white_points1/white_points2)*100;
display((total_matched_percentage));
if(total_matched_percentage >= 85)
time=20;
display(time);
elseif(total_matched_percentage >= 50 && total_matched_percentage <= 85)
time=40;
display(time);
else
time=60;
display(time);
end
</code>
No comments:
Post a Comment