您好,欢迎访问三七文档
当前位置:首页 > 医学/心理学 > 医学现状与发展 > 简单数字图像处理系统
数字图像课程设计简单数字图像处理系统functionvarargout=untitled(varargin)%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@untitled_OpeningFcn,...'gui_OutputFcn',@untitled_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callback',[]);ifnargin&&ischar(varargin{1})gui_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});end%Endinitializationcode-DONOTEDIT%---Executesjustbeforeuntitledismadevisible.functionuntitled_OpeningFcn(hObject,eventdata,handles,varargin)%界面初始化函数setappdata(handles.figure1,'I',0);%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstountitled(seeVARARGIN)%Choosedefaultcommandlineoutputforuntitledhandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesuntitledwaitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=untitled_OutputFcn(hObject,eventdata,handles)%界面输出函数%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Getdefaultcommandlineoutputfromhandlesstructurevarargout{1}=handles.output;%--------------------------------------------------------------------functionm_file_Callback(hObject,eventdata,handles)%hObjecthandletom_file(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%--------------------------------------------------------------------functionmy_file_open_Callback(hObject,eventdata,handles)globalI;[FileName,PathName]=uigetfile('*.bmp;*.jpg;*.tiff;*.gif');%弹出对话框得到打开的路径I=imread(strcat(PathName,FileName));%打开得到的路径下的文件imshow(I)setappdata(handles.figure1,'I',I);%handlesstructurewithhandlesanduserdata(seeGUIDATA)%--------------------------------------------------------------------functionmy_file_save_Callback(hObject,eventdata,handles)globalI;%这个是要保存的东西,一般是global的[FileName,PathName]=uiputfile('*.bmp;*.jpg;*.tiff;*.gif');%弹出对话框的到保存的路径imwrite(I,strcat(PathName,FileName));%存储到该路径下%uigetfileOpenstandarddialogboxforretrievingfiles%saveas(figure_handle,filename,fileformat)%saveas(gcf,'picname','jpg')%ifisequal(filename,0)||isequal(pathname,0)%return;%如果点了取消%else%fpath=fullfile(pathname,filename);%获取全路径的另一种方法%end%I=getappdata(handles.figure1,'I');%imwrite(I,fpath);%保存图片%--------------------------------------------------------------------functionmy_file_exit_Callback(hObject,eventdata,handles)close(handles.figure1);%退出%hObjecthandletomy_file_exit(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%--------------------------------------------------------------------functionmy_file_print_Callback(hObject,eventdata,handles)%hObjecthandletomy_file_print(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)C:\Users\swj\Documents\MATLAB\untitled.fig%--------------------------------------------------------------------functionm_image_Callback(hObject,eventdata,handles)%hObjecthandletom_image(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%--------------------------------------------------------------------functionm_image_2bw_Callback(hObject,eventdata,handles)%hObjecthandletom_image_2bw(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%--------------------------------------------------------------------functionm_image_tongji_Callback(hObject,eventdata,handles)%图像直方图的统计与绘制直方图反应灰度值与像素个数的关系%[FileName,PathName]=uigetfile('*.bmp;*.jpg;*.tiff;*.gif');%弹出对话框得到打开的路径%I=imread(strcat(PathName,FileName));%打开得到的路径下的文件globalI;A=rgb2gray(I);%将真彩色图像转换为灰度图像%figure('Name','显示灰度图像')subplot(2,2,1);imshow(I);title('原图');%imshow(A);[J,I]=histeq(A);%imshow(J);subplot(2,2,2);imhist(A,64);%提取图像中的直方图信息title('直方图的统计');%BW=bwperim(A,8);%figure('name','周长')%imshow(BW);%--------------------------------------------------------------------functionm_image_mianji_Callback(hObject,eventdata,handles)globalI;BW=bwperim(im2bw(I));%显示二值化后的图像Area=bwarea(BW)[labeled,numobjects]=bwlabel(BW,8);BW=regionprops(labeled,'basic')BW=BW.Area;set(handles.mj,'String',strcat('区域面积=',num2str(BW)));%--------------------------------------------------------------------functionm_image_zhouchang_Callback(hObject,eventdata,handles)%hObjecthandletom_image_zhouchang(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%--------------------------------------------------------------------functionjuli_Callback(hObject,eventdata,handles)%hObjecthandletojuli(seeGCBO)%
本文标题:简单数字图像处理系统
链接地址:https://www.777doc.com/doc-6196922 .html