matlab 图像处理算法集合原创GUI.docx
- 文档编号:3903542
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:36
- 大小:86.39KB
matlab 图像处理算法集合原创GUI.docx
《matlab 图像处理算法集合原创GUI.docx》由会员分享,可在线阅读,更多相关《matlab 图像处理算法集合原创GUI.docx(36页珍藏版)》请在冰豆网上搜索。
matlab图像处理算法集合原创GUI
通过点击菜单实现各种功能
functionvarargout=imageprocessinggui(varargin)
%IMAGEPROCESSINGGUIM-fileforimageprocessinggui.fig
%IMAGEPROCESSINGGUI,byitself,createsanewIMAGEPROCESSINGGUIorraisestheexisting
%singleton*.
%
%H=IMAGEPROCESSINGGUIreturnsthehandletoanewIMAGEPROCESSINGGUIorthehandleto
%theexistingsingleton*.
%
%IMAGEPROCESSINGGUI('CALLBACK',hObject,eventData,handles,...)callsthelocal
%functionnamedCALLBACKinIMAGEPROCESSINGGUI.Mwiththegiveninputarguments.
%
%IMAGEPROCESSINGGUI('Property','Value',...)createsanewIMAGEPROCESSINGGUIorraisesthe
%existingsingleton*.Startingfromtheleft,propertyvaluepairsare
%appliedtotheGUIbeforeimageprocessinggui_OpeningFcngetscalled.An
%unrecognizedpropertynameorinvalidvaluemakespropertyapplication
%stop.Allinputsarepassedtoimageprocessinggui_OpeningFcnviavarargin.
%
%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone
%instancetorun(singleton)".
%
%Seealso:
GUIDE,GUIDATA,GUIHANDLES
%Edittheabovetexttomodifytheresponsetohelpimageprocessinggui
%LastModifiedbyGUIDEv2.521-May-201220:
51:
04
%Begininitializationcode-DONOTEDIT
gui_Singleton=1;
gui_State=struct('gui_Name',mfilename,...
'gui_Singleton',gui_Singleton,...
'gui_OpeningFcn',@imageprocessinggui_OpeningFcn,...
'gui_OutputFcn',@imageprocessinggui_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
%---Executesjustbeforeimageprocessingguiismadevisible.
functionimageprocessinggui_OpeningFcn(hObject,eventdata,handles,varargin)
%Thisfunctionhasnooutputargs,seeOutputFcn.
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%varargincommandlineargumentstoimageprocessinggui(seeVARARGIN)
%Choosedefaultcommandlineoutputforimageprocessinggui
handles.output=hObject;
%Updatehandlesstructure
guidata(hObject,handles);
%UIWAITmakesimageprocessingguiwaitforuserresponse(seeUIRESUME)
%uiwait(handles.figure1);
%---Outputsfromthisfunctionarereturnedtothecommandline.
functionvarargout=imageprocessinggui_OutputFcn(hObject,eventdata,handles)
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%javaFrame=get(gcf,'JavaFrame');
%set(javaFrame,'Maximized',1);
%--------------------------------------------------------------------
functionUntitled_1_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_1(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_5_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_5(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_15_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_15(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionUntitled_25_Callback(hObject,eventdata,handles)
%hObjecthandletoUntitled_25(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%--------------------------------------------------------------------
functionGradientimage_Callback(hObject,eventdata,handles)
%hObjecthandletoGradientimage(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
globalim
axes(handles.axes1);
clareset;
axes(handles.axes2);
clareset;
axes(handles.axes3);
clareset;
axes(handles.axes4);
clareset;
P=im;
d=size(P);
if(d(3)>1)
P=rgb2gray(P);
end
axes(handles.axes1);
imshow(P);
title('灰度图像');
P=double(P);
[Px,Py]=gradient(P);
G=sqrt(Px.*Px+Py.*Py);
P=G;
P=uint8(P);
axes(handles.axes1);
imshow(P);
title('梯度图像1');
tou=input('inputthresholdtou=');
bh=input('inputaconstantintensitynearertowhitebh=');
P1=P;
k=find(G>=tou);
P1(k)=bh;
axes(handles.axes2);
imshow(P1);
title('梯度图像2');
bl=input('inputaconstantintensitynearertoblackbl=');
P2=P;
h=find(G>=tou);
P2(h)=bh;
l=find(G P2(l)=bl; axes(handles.axes3); imshow(P2); title('梯度图像3'); P3=zeros(d (1),d (2)); fori=1: d (1) forj=1: d (2) if(G(i,j)>=tou) P3(i,j)=bh; else P3(i,j)=bl; end end end P3=uint8(P3); axes(handles.axes4); imshow(P3); title('梯度图像4'); %-------------------------------------------------------------------- functionUntitled_27_Callback(hObject,eventdata,handles) %hObjecthandletoUntitled_27(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) %-------------------------------------------------------------------- functionUntitled_16_Callback(hObject,eventdata,handles) %hObjecthandletoUntitled_16(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) %-------------------------------------------------------------------- functionUntitled_21_Callback(hObject,eventdata,handles) %hObjecthandletoUntitled_21(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) %-------------------------------------------------------------------- functionUntitled_6_Callback(hObject,eventdata,handles) %hObjecthandletoUntitled_6(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) %-------------------------------------------------------------------- functionUntitled_12_Callback(hObject,eventdata,handles) %hObjecthandletoUntitled_12(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) %-------------------------------------------------------------------- functionUntitled_2_Callback(hObject,eventdata,handles) %hObjecthandletoUntitled_2(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) globalS globalim axes(handles.axes1); clareset; axes(handles.axes2); clareset; axes(handles.axes3); clareset; axes(handles.axes4); clareset; [filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.gif';'*.tif';'*.png';'*jpeg'},'选择图片'); ifisequal(filename,0) disp('Userselectedcanceled'); else str=[pathnamefilename]; %globalS%设置一个全局变量S,保存初始图像路径,以便之后的还原操作 S=str; im=imread(str); axes(handles.axes1); imshow(im); title('原图像'); handles.img=im; guidata(hObject,handles); end %-------------------------------------------------------------------- functionsave_Callback(hObject,eventdata,handles) %hObjecthandletosave(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) newfig1=figure; new_h1=copyobj(handles.axes1,newfig1); set(new_h1,'Units','default','Position','default'); hp=getframe(new_h1); [filename1,pathname1]=uiputfile({'*.bmp','Bitmap(*.bmp)';... '*.jpg','JPEG(*.jpg)';... '*.gif','GIF(*.gif)';... '*.*','AllFiles(*.*)'},... 'SavePicture1','Picture1_1'); iffilename1==0 close(newfig1); return else imwrite(hp.cdata,fullfile(pathname1,filename1)); close(newfig1); end %-------------------------------------------------------------------- functionquit_Callback(hObject,eventdata,handles) %hObjecthandletoquit(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) clc; closeall; close(gcf); clear; %-------------------------------------------------------------------- functionlinearTran_Callback(hObject,eventdata,handles) %hObjecthandletolinearTran(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) globalim axes(handles.axes1); clareset; axes(handles.axes2); clareset; axes(handles.axes3); clareset; axes(handles.axes4); clareset; P=im; d=size(P); if(d(3)>1) P=rgb2gray(P); end axes(handles.axes1); imshow(P); title('灰度图像'); P=double(P); [mn]=size(P); g=zeros(m,n); %B=input('inputthestorageofeachpixel: '); B=8; bmin=min(min(P)); bmax=max(max(P)); fori=1: m forj=1: n g(i,j)=(2.^B-1)*(P(i,j)-bmin)/(bmax-bmin); end end g=uint8(g); axes(handles.axes2); imshow(g); title('经线性变换后的图像'); %-------------------------------------------------------------------- functionlimitlintran_Callback(hObject,eventdata,handles) %hObjecthandletolimitlintran(seeGCBO) %eventdatareserved-tobedefinedinafutureversionofMATLAB %handlesstructurewithhandlesanduserdata(seeGUIDATA) globalim axes(han
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 图像处理算法集合原创GUI 图像 处理 算法 集合 原创 GUI