图像预处理GUI.doc_第1页
图像预处理GUI.doc_第2页
图像预处理GUI.doc_第3页
图像预处理GUI.doc_第4页
图像预处理GUI.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

图像增强GUI的fig界面图像增强GUI的结果界面其m文件见txt文件:图像增强GUI的m文件:function varargout = imageenhance(varargin)% IMAGEENHANCE MATLAB code for imageenhance.fig% IMAGEENHANCE, by itself, creates a new IMAGEENHANCE or raises the existing% singleton*.% H = IMAGEENHANCE returns the handle to a new IMAGEENHANCE or the handle to% the existing singleton*.% IMAGEENHANCE(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in IMAGEENHANCE.M with the given input arguments.% IMAGEENHANCE(Property,Value,.) creates a new IMAGEENHANCE or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before imageenhance_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to imageenhance_OpeningFcn via varargin.% *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one% instance to run (singleton).% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help imageenhance % Last Modified by GUIDE v2.5 19-May-2012 20:00:36 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, imageenhance_OpeningFcn, . gui_OutputFcn, imageenhance_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before imageenhance is made visible.function imageenhance_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to imageenhance (see VARARGIN) % Choose default command line output for imageenhancehandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes imageenhance wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = imageenhance_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = handles.output; % - Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in loadimage2.function loadimage2_Callback(hObject, eventdata, handles)% hObject handle to loadimage2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global pic;fname pname index=uigetfile(*.jpg;*.bmp;*.gif);if indexstr=pname fnamepic=imread(str);%figure;imshow(pic);end; % - Executes on button press in pushbutton2.function pushbutton2_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)global pic;str=get(hObject,string);axes(handles.axes1);I=rgb2gray(pic);J=histeq(I); %figure;subplot(221),imshow(I),title(?-?);subplot(222),imshow(J),title(?oao?);subplot(223),imhist(I,64),title(?-?);subplot(224),imhist(J,64),title(?oa?o?);%figure;%subplot(121),imhist(I,64),title(?-?);subplot(122),imhist(J,64),title(?oao?); % - Executes on button press in loadimage1.function loadimage1_Callback(hObject, eventdata, handles)% hObject handle to loadimage1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global pic;fname pname index=uigetfile(*.jpg;*.bmp;*.gif);if indexstr=pname fnamepic=imread(str);%figure;imshow(pic);end; % - Executes when selected object is changed in multichoose.function multichoose_SelectionChangeFcn(hObject, eventdata, handles)% hObject handle to the selected object in multichoose % eventdata structure with the following fields (see UIBUTTONGROUP)% EventName: string SelectionChanged (read only)% OldValue: handle of the previously selected object or empty if none was selected% NewValue: handle of the currently selected object% handles structure with handles and user data (see GUIDATA)global pic;str=get(hObject,string);axes(handles.axes4);switch str case ?2 global pic; str=get(hObject,string); axes(handles.axes4); I=rgb2gray(pic); J1=imnoise(I,salt & pepper,0.02); J2=imnoise(I,gaussian,0.02); %average filter R1=filter2(fspecial(average,3),J1)/255; R2=filter2(fspecial(average,3),J2)/255; subplot(221),imshow(J1),title(?); subplot(222),imshow(J2),title(?1?); subplot(223),imshow(R1),title(D?2?); subplot(224),imshow(R2),title(D?1?2?); case?D?2 global pic; str=get(hObject,string); axes(handles.axes4); I=rgb2gray(pic); J1=imnoise(I,salt & pepper,0.02); J2=imnoise(I,gaussian,0.02); %median filter R1=medfilt2(J1,5,5); R2=medfilt2(J2,5,5); subplot(221),imshow(J1),title(?); subplot(222),imshow(J2),title(?1?); subplot(223),imshow(R1),title(D?D?2?); subplot(224),imshow(R2),title(D?1?D?2?); caseD?¥? global pic; str=get(hObject,string); axes(handles.axes4); I1=im2bw(pic); I2=rgb2gray(pic); se=strel(disk,5);R1=imdilate(I1,se);R2=imerode(I1,se); R5=imopen(I1,se);R6=imclose(I1,se); R3=imdilate(I2,se);R4=imerode(I2,se); R7=imopen(I2,se);R8=imclose(I2,se); subplot(521),imshow(R1),title(?t?o?); subplot(522),imshow(R3),title(?o?); subplot(523),imshow(R2),title(?t?o?); subplot(524),imshow(R4),title(?o?); subplot(525),imshow(R5),title(?t?a?o?); subplot(526),imshow(R7),title(?a?o?); subplot(527),imshow(R6),title(?t?o?); subplot(528),imshow(R8),title(?o?); end % - Executes during object creation, after setting all properties.function choose1_CreateFcn(hObject, eventdata, handles)% hObject handle to choose1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns calledglobal pic;str=get(hObject,string); I=rgb2gray(pic);J1=imnoise(I,salt & pepper,0.02);J2=imnoise(I,gaussian,0.02);%average filterR1=filter2(fspecial(average,3),J1)/255;R2=filter2(fspecial(average,3),J2)/255; % - Executes during object creation, after setting all properties.function choose2_CreateFcn(hObject, eventdata, handles)% hObject handle to choose2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns calledglobal pic;str=get(hObject,string); I=rgb2gray(pic);J1=imnoise(I,salt & pepper,0.02);J2=imnoise(I,gaussian,0.02);%median filterR3=medfilt2(J1,5,5);R4=medfilt2(J2,5,5); % - Executes during object creation, after setting all properties.function radiobutton4_CreateFcn(hObject, eventdata, handles)% hObject handle to radiobutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns calledglobal pic;str=get(hObject,string); I1=im2bw(pic);I2=rgb2gray(pic); se=strel(disk,5);R1=imdilate(I1,se);R2=imerode(I1,se); R5=imopen(I1,se);R6=imclose(I1,se); R3=imdilate(I2,se);R4=imerode(I2,se); R7=imopen(I2,se);R8=imclose(I2,se); % - Executes on key press with focus on radiobutton4 and none of its controls.function radiobutton4_KeyPressFcn(hObject, eventdata, handles)% hObject handle to radiobutton4 (se

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论