matlab图像去噪程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
function varargout = jiemian(varargin) %返回从函数jiemian.m中得到的参数中变量的数目;传递一个参数中变量的数目给函数jiemian.m。
% JIEMIAN Application M-file for jiemian.fig
% FIG = JIEMIAN launch jiemian GUI.
% JIEMIAN('callback_name', ...) invoke the named callback.
% Last Modified by shijiawei v2.5 24-May-2014 02:45:18
if nargin == 0 % LAUNCH GUI %nargin 显示输入变量
fig = openfig(mfilename,'reuse'); %打开包含在FIG文件filename.fig中的图形,确保它是可见的并且完全定位在屏幕上。
% Generate a structure of handles to pass to callbacks, and store it.
handles = guihandles(fig); %返回一个结构,它包含图像中对象的句柄
guidata(fig, handles); %将变量handles存储到fig文件中
if nargout > 0 %如果输出变量大于0
varargout{1} = fig; %返回fig
end
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK %如果varargin{1}是一个字符数组则返回逻辑真(1),否则返回逻辑假(0)。
try
if (nargout) %显示用户提供的输出变量的个数
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard %varargout传递参数中的变量数目else
feval(varargin{:}); % FEVAL switchyard %**feval函数的求值
end
catch %如果出错开始执行catch块
disp(lasterr); %%%% lasterr函数查询出错原因。如果函数lasterr的运行结果为一个空串,则表明组命令1被成功执行了
%%%% disp 显示矩阵和文字内容
end
end
%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and
%| sets objects' callback properties to call them through the FEVAL
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%|
%|
%| The subfunction name is composed using the object's Tag and the
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback. You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks. Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%|
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.
% --------------------------------------------------------------------
function varargout = LoadPush_Callback(h, eventdata, handles, varargin)%回调函数%返回从函数()中得到的参数中变量的数目。
global im_original im_noised im_filtered%global:定义全局变量%原始图像,噪声图像,去噪图像
[filename, pathname] = uigetfile('*.bmp;*.pgm;*.tif;*.jpg;*.*', 'Load input image');%读取文件
if isequal(filename,0) | isequal(pathname,0) %确定数组是否数值相等,如果输入数组具有相同的维数、相同的类型并且具有相同的内容则返回逻辑真(1),否则返回逻辑假(0)。
disp('User pressed cancel')%disp:显示
else
disp(['User selected ', fullfile(pathname, filename)]) %显示用户选项,显示路径名称和文件文件end
im_original=imread(filename); %从图形文件中读取图像。
set(handles.Or_image,'HandleVisibility','OFF');%handles:句柄axes[坐标]的句柄不可见%注释掉影响不大
set(handles.Out_image,'HandleVisibility','OFF'); %注释掉影响不大
%set(handles.Denoised_image,'HandleVisibility','OFF');
set(handles.Or_image,'HandleVisibility','ON'); %注释掉影响不大axes(handles.Or_image); %设置现有轴handles.Or_image为当前轴。
imshow(im_original); %显示原始图像
colormap(gray(256)); %将当前的颜色图设置为256灰度
axis equal;%让图像的大小与框架吻合
axis tight;%同上
axis off;%把数轴关掉