Load one Image and it will Compare with All Images in database Folder and Tell does it match with any image or Not

6 visualizzazioni (ultimi 30 giorni)
I have created GUI with four button and Behind two button (pushbutton1_Callback) ( pushbutton2_Callback) which can simply load two images and then using other two button i will generate iris template . now i want that one button only read the image as input then i want that this image will make comparison with all images in database folder . Code below will take two images of eye and then clicking Generate Template it will create template for first image and second button will create template for second image and as well tell that whether these two images are same or not . Now tell me how i can change this code that it can only load one image and Comparison with All images stored in database Folder in my Path of matlab
Please Modify this Code i am Thankful to you
function pushbutton1_Callback(hObject, eventdata, handles)
[filename, pathname]=uigetfile('*.*','Choose an iris image');
fig=imread(strcat(pathname,filename));
setappdata(handles.figure1,'IrisImg1',fig);
subplot(3,1,1);imshow(fig);
function pushbutton2_Callback(hObject, eventdata, handles)
[filename, pathname]=uigetfile('*.*','Choose an iris image');
fig=imread(strcat(pathname,filename));
setappdata(handles.figure1,'IrisImg2',fig);
subplot(3,1,2);imshow(fig);
function template1_Callback(hObject, eventdata, handles)
eye=getappdata(handles.figure1,'IrisImg1');
[local xc yc time]=localisation2(eye,0.2);
[ci cp out time]=thresh(local,50,200);
[ring,parr]=normaliseiris(local,ci(2),ci(1),ci(3),cp(2),cp(1),cp(3),'normal.bmp',100,300);
[temp th tv]=gen_templateVVV(parr);
setappdata(handles.figure1,'temp1',temp);
subplot(3,1,1);imshow(temp);
function template2_Callback(hObject, eventdata, handles)
eye=getappdata(handles.figure1,'IrisImg2');
[local xc yc time]=localisation2(eye,0.2);
[ci cp out time]=thresh(local,50,200);
[ring,parr]=normaliseiris(local,ci(2),ci(1),ci(3),cp(2),cp(1),cp(3),'normal.bmp',100,300);
[temp2 th tv]=gen_templateVVV(parr);
subplot(3,1,2);imshow(temp2);
temp1=getappdata(handles.figure1,'temp1');
hd=hammingdist(temp1, temp2);
if(hd<=0.2)
message=[ 'Hamming Distance b.w two images ' num2str(hd) ' Template are From Same Eye '];
msgbox(message);
else
message=[ 'Hamming Distance b.w two images ' num2str(hd) ' Template are not From Same eye '];
msgbox(message);
end
end

Risposte (1)

Salma Hassan
Salma Hassan il 17 Gen 2018
Modificato: Salma Hassan il 17 Gen 2018
srcFiles = dir('D:.............\1\*.png');
image_1=length(srcFiles);
srcFiles2 = dir('D:\...........\2\*.png');
image_2=length(srcFiles2);
for i = 1 : image_1
aa = strcat('D:\........... \1\',srcFiles(i).name);
a = imread(aa); %first img
for j=1:image_2
bb = strcat('D:\.......... \2\',srcFiles2(j).name);
b = imread(bb); %second img
c = corr2(a,b); %finding the correlation
if c==1
disp('The images are same') % display
else
disp('the images are not same')
end
end
end

Categorie

Scopri di più su Image Data Workflows in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by