数字图像处理matlabGUI处理包.docx
《数字图像处理matlabGUI处理包.docx》由会员分享,可在线阅读,更多相关《数字图像处理matlabGUI处理包.docx(24页珍藏版)》请在冰点文库上搜索。
![数字图像处理matlabGUI处理包.docx](https://file1.bingdoc.com/fileroot1/2023-7/6/55a3b8ec-9988-455f-a46e-bbc6670fedf4/55a3b8ec-9988-455f-a46e-bbc6670fedf41.gif)
数字图像处理matlabGUI处理包
functionvarargout=digital_image_processing(varargin)
%DIGITAL_IMAGE_PROCESSINGMATLABcodefordigital_image_processing.fig
%DIGITAL_IMAGE_PROCESSING,byitself,createsanewDIGITAL_IMAGE_PROCESSINGorraisestheexisting
%singleton*.
%
%H=DIGITAL_IMAGE_PROCESSINGreturnsthehandletoanewDIGITAL_IMAGE_PROCESSINGorthehandleto
%theexistingsingleton*.
%
%DIGITAL_IMAGE_PROCESSING('CALLBACK',hObject,eventData,handles,...)callsthelocal
%functionnamedCALLBACKinDIGITAL_IMAGE_PROCESSING.Mwiththegiveninputarguments.
%
%DIGITAL_IMAGE_PROCESSING('Property','Value',...)createsanewDIGITAL_IMAGE_PROCESSINGorraisesthe
%existingsingleton*.Startingfromtheleft,propertyvaluepairsare
%appliedtotheGUIbeforedigital_image_processing_OpeningFcngetscalled.An
%unrecognizedpropertynameorinvalidvaluemakespropertyapplication
%stop.Allinputsarepassedtodigital_image_processing_OpeningFcnviavarargin.
%
%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone
%instancetorun(singleton)".
%
%Seealso:
GUIDE,GUIDATA,GUIHANDLES
%Edittheabovetexttomodifytheresponsetohelpdigital_image_processing
%LastModifiedbyGUIDEv2.521-Nov-201714:
07:
42
%Begininitializationcode-DONOTEDIT
gui_Singleton=1;
gui_State=struct('gui_Name',mfilename,...
'gui_Singleton',gui_Singleton,...
'gui_OpeningFcn',@digital_image_processing_OpeningFcn,...
'gui_OutputFcn',@digital_image_processing_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{:
});
end
%Endinitializationcode-DONOTEDIT
%---Executesjustbeforedigital_image_processingismadevisible.
functiondigital_image_processing_OpeningFcn(hObject,eventdata,handles,varargin)
%Thisfunctionhasnooutputargs,seeOutputFcn.
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%varargincommandlineargumentstodigital_image_processing(seeVARARGIN)
%Choosedefaultcommandlineoutputfordigital_image_processing
handles.output=hObject;
%Updatehandlesstructure
guidata(hObject,handles);
%UIWAITmakesdigital_image_processingwaitforuserresponse(seeUIRESUME)
%uiwait(handles.figure1);
%---Outputsfromthisfunctionarereturnedtothecommandline.
functionvarargout=digital_image_processing_OutputFcn(hObject,eventdata,handles)
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%---Executesonselectionchangeinpopupmenu1.
functionpopupmenu1_Callback(hObject,eventdata,handles)
%hObjecthandletopopupmenu1(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Hints:
contents=cellstr(get(hObject,'String'))returnspopupmenu1contentsascellarray
%contents{get(hObject,'Value')}returnsselecteditemfrompopupmenu1
%---Executesduringobjctcreation,aftersettingallproperties.
functionpopupmenu1_CreateFcn(hObject,eventdata,handles)
%hObjecthandletopopupmenu1(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
popupmenucontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
%--------------------------------------------------------------------
functionUntitled_1_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_1(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%-------------------------------------------------------------------
functionUntitled_3_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_3(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_14_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_14(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_25_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_25(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_29_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_29(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_32_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_32(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_33_Callback(hObject,eventdata,handles)
%ÇøÓòÂ˲¨
%hObjecthandletoUntitled_33(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
I=handles.img;
c=[222272300270221194];
r=[21217512112175];
BW=roipoly(I,c,r);
H=fspecial('unsharp');
J=roifilt2(H,I,BW);
figure,imshow(I);
figure,imshow(J);
handles.img=I;
guidata(hObject,handles);
%--------------------------------------------------------------------
functionUntitled_34_Callback(hObject,eventdata,handles)
%ÇøÓòÌî³äÖ®ºóµÄͼÏñ
%hObjecthandletoUntitled_34(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
I=handles.img;
c=[222272300270221194];
r=[21217512112175];
J=roifill(I,c,r);
figure,imshow(I);
title('ÔʼͼÏñ');
figure,imshow(J);
title('ÇøÓòÌî³äÖ®ºóµÄͼÏñ');
handles.img=I;
guidata(hObject,handles);
%--------------------------------------------------------------------
%¸µÀïÒ¶±ä»»
functionUntitled_30_Callback(~,eventdata,handles)
%hObjecthandletoUntitled_30(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%f=zeros(30,30);
%f(5:
24,13:
17)=1;
%axes(handles.dispaly1);
%imshow(f,'InitialMagnification','fit');
%imwrite(f,'file.jpg');
f=handles.img;
F=fft2(f,256,256);
F1=fftshift(F);
F2=log(abs(F1));
axes(handles.display2);
imshow(F2,[]),title('¸µÀïÒ¶±ä»»·ù¶ÈƵÆ×');
handles.img=img;
guidata(hObject,handles);
%--------------------------------------------------------------------
functionUntitled_31_Callback(hObject,eventdata,handles)
%ÓàÏұ任
%hObjecthandletoUntitled_31(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
RGB=handles.img;
%I=rgb2gray(RGB);
J=dct2(RGB);
figure;
imshow(log(abs(J)),[]);
title('DCT±ä»»»Ò¶ÈͼÏñ');
colormap(gray(4));
colorbar
J(abs(J)<0.01)=0;
K=idct2(J);
axes(handles.display2);
imshow(K);
title('¾¹ýDCT±ä»»£¬È»ºóÄæ±ä»»µÄ»Ò¶ÈͼÏñ');
handles.img=RGB;
guidata(hObject,handles);
%--------------------------------------------------------------------
%ÏßÐÔÂ˲¨
functionUntitled_26_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_26(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
I=handles.img;
J=imnoise(I,'salt&pepper',0.02);
figure,imshow(J);
K=filter2(fspecial('average',3),J)/255;
figure,imshow(K);
title('¾ùÖµÂ˲¨Æ÷');
handles.img=I;
guidata(hObject,handles);
%--------------------------------------------------------------------
%ÖÐÖµÂ˲¨
functionUntitled_27_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_27(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
I=handles.img;
J=imnoise(I,'salt&pepper',0.02);
figure,imshow(J);
L=medfilt2(J,[33]);
figure,imshow(L);
title('ÖÐÖµÂ˲¨¶ÔÂ˳ýͼÏñµÄ½·ÑÎÔëÉù·Ç³£ÓÐЧ');
handles.img=I;
guidata(hObject,handles);
%--------------------------------------------------------------------
%×ÔÊÊÓ¦Â˲¨
functionUntitled_28_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_28(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
I=handles.img;
J=imnoise(I,'gaussian',0,0.025);
figure,imshow(J);
L=wiener2(J,[55]);
figure,imshow(L);
title('×ÔÊÊÓ¦Â˲¨¶Ôº¬Óиß˹ÔëÉùµÄͼÏñÂ˲¨Ð§¹û½ÏºÃ');
handles.img=I;
guidata(hObject,handles);
%----------------------------------------------