the second call back function does not work in gui .could any one help me?

3 ビュー (過去 30 日間)
indrani dalui
indrani dalui 2017 年 6 月 26 日
コメント済み: Walter Roberson 2017 年 7 月 1 日
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.bmp';'*.jpg';'*.gif';'*.*'}, 'Pick an Image File');
S = imread([pathname,filename]);
axes(handles.axes1);
imshow(S);
handles.f=[pathname,filename];
guidata(hObject, handles);
figure1.text = 'image uploaded'
% --- Executes on button press in pushbutton2.
function process_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, 'f')
imread = handles.f;
% convert to binary
binary_image=im2bw(imread('handles.f'));
%Small region is taken to show output clear
binary_image = binary_image(120:400,20:250);
figure;imshow(binary_image);title('Input image');

採用された回答

Jan
Jan 2017 年 6 月 26 日
編集済み: Jan 2017 年 6 月 26 日
  • Please do not only state "does not work", but explain what you see. do you get an error message or do the results differ from your expectations?
function process_Callback(hObject, eventdata, handles)
if isfield(handles, 'myImage')
myImage = handles.f;
binary_image=im2bw(imread('handles.f'));
Now the image with the name 'handles.f' is loaded, but you want:
binary_image=im2bw(imread(handles.f));
without quotes. The error message should reveal this directly. Note that Walter has mentioned this already, so please update your code.
  • The purpose of the figure1.text = 'image uploaded' lines is not clear to me.
  • Simplification:
% Replace this:
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;
% By this:
mat(1:2*n + 1,1:2*n+1) = temp(x-n:x+n, y-n:y+n);
% Or even better:
mat = temp(x-n:x+n, y-n:y+n);
  6 件のコメント
indrani dalui
indrani dalui 2017 年 7 月 1 日
編集済み: Walter Roberson 2017 年 7 月 1 日
sir,after two images output i want compare both two images ..is similar or not within one push button... code is bellow.what to do sir?
% --- Executes on button press in Recognation.
function Recognation_Callback(hObject, eventdata, ~)
% hObject handle to Recognation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if isequal(f,f2) % f and f2 are compared
msgbox('Both f and f2 are equal', 'MESSAGE');
else
msgbox('f and f2 are not equal', 'MESSAGE');
end
Walter Roberson
Walter Roberson 2017 年 7 月 1 日
f and f2 are not defined in your function Recognation_Callback

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 6 月 26 日
if isfield(handles, 'f')
% convert to binary
binary_image = im2bw( imread(handles.f) );
%Small region is taken to show output clear
binary_image = binary_image(120:400,20:250);
figure;
imshow(binary_image);
title('Input image');
end
  23 件のコメント
indrani dalui
indrani dalui 2017 年 6 月 29 日
編集済み: Walter Roberson 2017 年 6 月 29 日
sir,after extraction minutiae how to count ridge-end and bifurcation point and location instead of bellow code..
function Process_Callback(hObject, eventdata, handles)
% hObject handle to Process (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, 'f')
% convert to binary
binary_image = im2bw( imread(handles.f) );
%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
Walter Roberson
Walter Roberson 2017 年 6 月 29 日
I don't know. I do not do fingerprint work.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by