how to call pic1 and pic2 in pushbutton3_callbacks

I have load pic1 in pushbutton 1 and load pic2 in pushbutton 2. I want to compare these two picture in pushbutton3_callbacks. How to call pic1 and pic2 in pushbotton3_callback.
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
%global pic1
[filename pathname] = uigetfile ({'*.tif';'*.bmp'},'File Selector');
pic1= strcat (pathname,filename);
axes(handles.axes1)
imshow(pic1)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
global pic2
[filename pathname] = uigetfile ({'*.tif';'*.bmp'},'File Selector');
pic2= strcat (pathname,filename);
axes(handles.axes2)
imshow(pic2)
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
%so that we obtain white and black points and edges of the objects present
%in the picture.
edge_det_pic1 = edge(image1,'prewitt');
%applying edge detection on first picture
%so that we obtain white and black points and edges of the objects present
%in the picture.
edge_det_pic2 = edge(image2,'prewitt');
%initialization of different variables used
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(edge_det_pic1(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(edge_det_pic1(i,j)==1)&&(edge_det_pic2(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;
%outputting the result of the system.
if(total_matched_percentage >= 17)
%can add flexability at this point by reducing the amount of matching.
total_matched_percentage
msgbox('The Fingerprint is MATCHING');
else
total_matched_percentage
msgbox('The Fingerprint is NOT MATCHING');
end

Categories

Find more on Environment and Settings in Help Center and File Exchange

Asked:

on 19 May 2015

Answered:

on 19 May 2015

Community Treasure Hunt

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

Start Hunting!