function varargout = untitled11(varargin)
% UNTITLED11 M-file for untitled11.fig
% UNTITLED11, by itself, creates a new UNTITLED11 or raises the existing
% singleton*.
%
% H = UNTITLED11 returns the handle to a new UNTITLED11 or the handle to
% the existing singleton*.
%
% UNTITLED11('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED11.M with the given input arguments.
%
% UNTITLED11('Property','Value',...) creates a new UNTITLED11 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled11_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled11_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 untitled11
% Last Modified by GUIDE v2.5 15-Jun-2012 12:32:49
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled11_OpeningFcn, ...
'gui_OutputFcn', @untitled11_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 untitled11 is made visible.
function untitled11_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 untitled11 (see VARARGIN)
% Choose default command line output for untitled11
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled11 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled11_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;
% --------------------------------------------------------------------
function menu_file_Callback(hObject, eventdata, handles)
% hObject handle to menu_file (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_edit_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_noise_Callback(hObject, eventdata, handles)
% hObject handle to menu_noise (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function edit_rgb2gry_Callback(hObject, eventdata, handles)
% hObject handle to edit_rgb2gry (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image %彩色图像转为灰色图像
global A
axes(handles.axes2);
if isrgb(image)
imshow(rgb2gray(image));
else
msgbox('error');
end
% --------------------------------------------------------------------
function file_open_Callback(hObject, eventdata, handles)
% hObject handle to file_open (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image %打开图片
global A
[filename,pathname]=...
uigetfile({'*.jpg';'*.bap';'*.gif'},'选择图片');
str=[pathname,filename];
image=imread(str);
A=str;
axes(handles.axes1);
imshow(image);
% --------------------------------------------------------------------
function file_save_as_Callback(hObject, eventdata, handles)
% hObject handle to file_save_as (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function file_exit_Callback(hObject, eventdata, handles)
% hObject handle to file_exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(gcf) %退出
% --------------------------------------------------------------------
function noise_salt_pepper_Callback(hObject, eventdata, handles)
% hObject handle to noise_salt_pepper (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image %加椒盐噪声
global A
axes(handles.axes2);
a=imnoise(image,'salt & pepper',0.02);
imshow(a);
% --------------------------------------------------------------------
function noise_gaussian_Callback(hObject, eventdata, handles)
% hObject handle to noise_gaussian (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image %加高斯噪声
global A
axes(handles.axes3);
a=imnoise(image,'gaussian',0.02);
imshow(a);
% --------------------------------------------------------------------
function menu_smoothing_Callback(hObject, eventdata, handles)
% hObject handle to menu_smoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function smoothing_average_Callback(hObject, eventdata, handles)
% hObject handle to smoothing_average (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image %均值滤波
global A
h=fspecial('average',5);
g=imfilter(image,h);
axes(handles.axes2);
imshow(g);
% --------------------------------------------------------------------
function smoothing_gaussian_Callback(hObject, eventdata, handles)
% hObject handle to smoothing_gaussian (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image %高斯低通滤波
global A
h=fspecial('gaussian',9);
g=imfilter(image,h);
axes(handles.axes3);
imshow(g);
% --------------------------------------------------------------------
function sharpen_laplacian_Callback(hObject, eventdata, handles)
% hObject handle to sharpen_laplacian (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image %拉布拉斯锐化算子
global A
h=fspecial('laplacian',0.5);
g=imfilter(image,h);
axes(handles.axes2);
imshow(g);
% --------------------------------------------------------------------
function smoothing_motion_Callback(hObject, eventdata, handles)
% hObject handle to smo