create two push button first image upload and second is call that image to second push button function ..but not connected to second call back ..please help me

조회 수: 1 (최근 30일)
% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) [filename, pathname] = uigetfile({'*.bmp';'*.jpg';'*.gif';'*.*'}, 'Pick an Image File'); MyImage = imread([pathname,filename]); axes(handles.axes1); imshow(MyImage); handles.MyImage=[MyImage]; guidata(hObject, handles); figure1.text = 'image uploaded'
secoent call back
% --- 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)
if isfield(handles,'MyImage')
% Read MyImage binary_image = im2bw(MyImage);
%Small region is taken to show output clear
binary_image = binary_image(120:400,20:250);
figure;
imshow(binary_image);
title('Input image');
%Thinning thin_image=~bwmorph(binary_image,'thin',Inf); figure;imshow(thin_image);title('Thinned Image');
%Minutiae extraction s=size(thin_image); N=3;%window size n=(N-1)/2; r=s(1)+2*n; c=s(2)+2*n; double temp(r,c); temp=zeros(r,c);bifurcation=zeros(r,c);ridge=zeros(r,c); temp((n+1):(end-n),(n+1):(end-n))=thin_image(:,:); outImg=zeros(r,c,3);%For Display outImg(:,:,1) = temp .* 255; outImg(:,:,2) = temp .* 255; outImg(:,:,3) = temp .* 255; for x=(n+1+10):(s(1)+n-10) for y=(n+1+10):(s(2)+n-10) e=1; for k=x-n:x+n f=1; for l=y-n:y+n mat(e,f)=temp(k,l); f=f+1; end e=e+1; end; if(mat(2,2)==0) ridge(x,y)=sum(sum(~mat)); bifurcation(x,y)=sum(sum(~mat)); end end; end;
% RIDGE END FINDING [ridge_x ridge_y]=find(ridge==2); len=length(ridge_x); %For Display for i=1:len outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),2:3)=0; outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),2:3)=0; outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0; outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),1)=255;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),1)=255;
outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
end
%BIFURCATION FINDING [bifurcation_x bifurcation_y]=find(bifurcation==4); len=length(bifurcation_x); %For Display for i=1:len outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),1:2)=0; outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),1:2)=0; outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0; outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),3)=255;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
end
figure;imshow(outImg);title('Minutiae');
end
% --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
  댓글 수: 1
Jan
Jan 2017년 6월 26일
편집: Jan 2017년 6월 26일
  1. Please use the "{} Code" button to format your code. Don't you see it is not readable yet?
  2. Explain the problem with any details. "not connected to second call back" is not clear enough to be answerd. Which one is the "2nd callback" and what does "connected" mean here?
  3. I have suggested some improvements of this code in another thread some minutes ago. Please post only one thread per problem, otherwise the confusion level is growing.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by