pushbutton1 to load the image from file
if true % % --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
path = 'C:\Users\yazid-daa\Desktop\fyp\matlab\';filter = '*.jpg';selectedFile = uigetfile(fullfile(path , filter))b =['C:\Users\yazid-daa\Desktop\fyp\matlab\',selectedFile]a= imread(b);figure,imshow(a),title('Face Recognition')end
where pushbutton2 to process the image
if true % --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)B=rgb2gray(a);figure,imshow(B),title('GrayImage');C=im2bw(B);figure,imshow(C),title('im2bw');D=medfilt2(B,[5 5]);E=D(:,:,1);threshold=160/255;bw=im2bw(E,threshold);figure,imshow(bw);bw=bwareaopen(bw,10000);se=strel('disk',20);bw=imclose(bw,se);bw=~bw;bw=imfill(bw,'holes');figure,imshow(bw);end
how can the image choose from the file can be callback to pushbutton2 without load back from the file??
Best Answer