数字图像处理实验四、基于GUIDE图像处理软件开发
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实验四、基于GUIDE的图像处理软件开发
一、实验目的
(1)学习使用MATLAB GUIDE的基本操作。
(2)以图像增强为例完成基本图像处理功能的回调函数编写。
二、实验主要仪器设备
(1)台式机或笔记本电脑。
(2)MATLAB软件(含GUIDE开发环境)。
三、实验原理
(1)基于灰度直方图变换的图像增强。
(2)灰度修正图像增强。
(3)图像平滑滤波。
(4)图像锐化处理。
四、实验容
(1)直方图的计算及用直方图均衡原理增强图像。
(2)线性灰度变换图像增强。
(3)对受椒盐噪声污染的图像采用低通处理模板去燥。
(4)对受椒盐噪声污染的图像采用中值滤波去噪。
(5)对图像采用梯度算子和拉普拉斯算子进行锐化。
五、实验步骤
(1)建立开发环境。
(2)编写相关回调函数。
(3)不断调试、优化,获得较满意的人机交互效果。
六、实验程序
function varargout = test4(varargin)
% TEST4 MATLAB code for test4.fig
% TEST4, by itself, creates a new TEST4 or raises the existing
% singleton*.
%
% H = TEST4 returns the handle to a new TEST4 or the handle to
% the existing singleton*.
%
% TEST4('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TEST4.M with the given input arguments. %
% TEST4('Property','Value',...) creates a new TEST4 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before test4_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application % stop. All inputs are passed to test4_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's 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 test4
% Last Modified by GUIDE v2.5 30-May-2017 17:23:54
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', test4_OpeningFcn, ...
'gui_OutputFcn', test4_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before test4 is made visible.
function test4_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 test4 (see VARARGIN)
% Choose default command line output for test4
handles.output = hObject;
I = ones(256,256);
axes(handles.axes1);imshow(I);
axes(handles.axes2);imshow(I);
axes(handles.axes3);imshow(I);
axes(handles.axes4);imshow(I);
axes(handles.axes5);imshow(I);
axes(handles.axes6);imshow(I);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes test4 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = test4_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 structure varargout{1} = handles.output;
% --- Executes on button press in OpenFile.
function OpenFile_Callback(hObject, eventdata, handles)
[file path] = uigetfile('*.bmp;*.jpg;*.png','ÇëÑ¡ÔñÒ»·ùͼÏñ');
if file == 0 warndlg('ÄãµÃÊäÈëÒ»·ùͼÏñ');
%¾¯¸æ¶Ô»°¿òÌáʾÊäÈëºÏ·¨Í¼ÏñÎļþ
else I = imread(fullfile(path,file));
axes(handles.axes1);