matlab毕业编程谷速软件图像匹配Word下载.docx
《matlab毕业编程谷速软件图像匹配Word下载.docx》由会员分享,可在线阅读,更多相关《matlab毕业编程谷速软件图像匹配Word下载.docx(11页珍藏版)》请在冰豆网上搜索。
sToolsmenu.Choose"
GUIallowsonlyone
%instancetorun(singleton)"
.
%Seealso:
GUIDE,GUIDATA,GUIHANDLES
%Copyright2002-2003TheMathWorks,Inc.
%Edittheabovetexttomodifytheresponsetohelppush
%LastModifiedbyGUIDEv2.521-Nov-200811:
43:
53
%Begininitializationcode-DONOTTARGET
gui_Singleton=1;
gui_State=struct('
gui_Name'
mfilename,...
'
gui_Singleton'
gui_Singleton,...
gui_OpeningFcn'
@push_OpeningFcn,...
gui_OutputFcn'
@push_OutputFcn,...
gui_LayoutFcn'
[],...
gui_Callback'
[]);
ifnargin&
&
ischar(varargin{1})
gui_State.gui_Callback=str2func(varargin{1});
end
ifnargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
});
else
gui_mainfcn(gui_State,varargin{:
%Endinitializationcode-DONOTTARGET
%---Executesjustbeforepushismadevisible.
functionpush_OpeningFcn(hObject,eventdata,handles,varargin)
%Thisfunctionhasnooutputargs,seeOutputFcn.
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%varargincommandlineargumentstopush(seeVARARGIN)
%Choosedefaultcommandlineoutputforpush
handles.pic='
test1.jpg'
;
handles.output=hObject;
%Updatehandlesstructure
guidata(hObject,handles);
%UIWAITmakespushwaitforuserresponse(seeUIRESUME)
%uiwait(handles.figure1);
%---Outputsfromthisfunctionarereturnedtothecommandline.
functionvarargout=push_OutputFcn(hObject,eventdata,handles)
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%---Executesonbuttonpressinpushbutton1.
functionpushbutton1_Callback(hObject,eventdata,handles)
%hObjecthandletopushbutton1(seeGCBO)
%set(handles.text1,'
String'
'
pushbuttonpushed'
)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FunctionDevelopedbyFahdA.Abbasi.
%DepartmentofElectricalandElectronicsEngineering,Universityof
%EngineeringandTechnology,Taxila,PAKISTAN.
%Thefunctiontakestwoimagesasargumentandusingedgedetection
%checkswhethertheyarethesameornot...acoolandsimplecodewhich
%canbeusedinsecuritysystems.
%Thelevelatwhichthetwopicturesshouldbematchedcanbecontrolled
%bychangingthecodeatline100.
%USAGE(SAMPLECODE)
%pic1=imread('
cameraman.tif'
);
%pic2=imread('
%ait_picmatch(pic1,pic2);
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%functionpattmatch(k,p)
display('
anish'
k=handles.XX;
p=handles.YY;
[x,y,z]=size(k);
if(z==1)
;
k=rgb2gray(k);
[x,y,z]=size(p);
p=rgb2gray(p);
%applyingedgedetectiononfirstpicture
%sothatweobtainwhiteandblackpointsandedgesoftheobjectspresent
%inthepicture.
edge_det_k=edge(k,'
prewitt'
%%applyingedgedetectiononsecondpicture
edge_det_p=edge(p,'
%definitionofdifferentvariablestobeusedinthecodebelow
%outputvariableifpictureshavebeenmatched.
OUTPUT_MESSAGE='
almostsamex-rayimages'
%outputvariableifobjectsinthewholepicturehavenotbeenmatched.
OUTPUT_MESSAGE2='
x-rayimagesnotmatching'
%initializationofdifferentvariablesused
matched_data=0;
white_points=0;
black_points=0;
x=0;
y=0;
l=0;
m=0;
%forloopusedfordetectingblackandwhitepointsinthepicture.
fora=1:
1:
300
forb=1:
if(edge_det_k(a,b)==1)
white_points=white_points+1;
else
black_points=black_points+1;
end
testing'
%forloopcomparingthewhite(edgepoints)inthetwopictures
fori=1:
forj=1:
if(edge_det_k(i,j)==1)&
(edge_det_p(i,j)==1)
matched_data=matched_data+1;
%calculatingpercentagematching.
total_data=white_points;
total_matched_percentage=(matched_data/total_data)*100;
%handles.pp=total_matched_percentage;
%guidata(hObject,handles);
set(handles.result,'
total_matched_percentage);
%outputtingtheresultofthesystem.
if(total_matched_percentage>
=85)%canaddflexabilityatthispointbyreducingtheamountofmatching.
total_matched_percentage
OUTPUT_MESSAGE
display(OUTPUT_MESSAGE);
set(handles.result1,'
OUTPUT_MESSAGE);
OUTPUT_MESSAGE2
display(OUTPUT_MESSAGE2);
OUTPUT_MESSAGE2);
%---Executesduringobjectcreation,aftersettingallproperties.
functiontext1_CreateFcn(hObject,eventdata,handles)
%hObjecthandletotext1(seeGCBO)
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%--------------------------------------------------------------------
functionsource_Callback(hObject,eventdata,handles)
%hObjecthandletosource(seeGCBO)
file=uigetfile('
*.jpg'
if~isequal(file,0)
k=imread(file);
handles.YY=k;
z=k;
guidata(hObject,handles);
subplot(2,2,1),imshow(k);
title('
source'
functionnew_Callback(hObject,eventdata,handles)
%hObjecthandletonew(seeGCBO)
functiontarget_Callback(hObject,eventdata,handles)
%hObjecthandletotarget(seeGCBO)
p=imread(file);
subplot(2,2,2),imshow(p);
target'
handles.XX=p;
functionUntitled_2_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_2(seeGCBO)
functionUntitled_1_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_1(seeGCBO)
functionabout_Callback(hObject,eventdata,handles)
%hObjecthandletoabout(seeGCBO)
msgbox('
codedbyANISHFRANCIS,lecturer,ECEDEPT'
functionUntitled_5_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_5(seeGCBO)
functionUntitled_6_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_6(seeGCBO)
functionhowto_Callback(hObject,eventdata,handles)
%hObjecthandletohowto(seeGCBO)
usemediumsizedimages'
functionfigure1_CreateFcn(hObject,eventdata,handles)
%hObjecthandletofigure1(seeGCBO)
functionopen_Callback(hObject,eventdata,handles)
%hObjecthandletoopen(seeGCBO)
%handlesstr