function varargout = untitled(varargin)
% UNTITLED M-file for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED.M with the given input arguments.
%
% UNTITLED('Property','Value',...) creates a new UNTITLED or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help untitled
% Last Modified by GUIDE v2.5 27-May-2014 22:19:18
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled_OpeningFcn, ...
'gui_OutputFcn', @untitled_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 untitled is made visible.
function untitled_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 untitled (see VARARGIN)
set(handles.axes_org,'Xtick',[],'Ytick',[],'Box','on');
set(handles.axes_deal,'Xtick',[],'Ytick',[],'Box','on');
set(handles.axes_org,'Color',[0.678 0.922 1.0]);
set(handles.axes_deal,'Color',[0.678 0.922 1.0])
setappdata(handles.figure_pjimage,'img_src',0);
setappdata(handles.figure_pjimage,'img_save',0);
% Choose default command line output for untitled
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled wait for user response (see UIRESUME)
% uiwait(handles.figure_pjimage);
% --- Outputs from this function are returned to the command line.
function varargout = untitled_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 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)
[filename, pathname] = uigetfile({'*.bmp;*.jpg;*.png;*.jpeg', 'Image Files (*.bmp, *.jpg, *.png,*.jpeg)';'*.*', 'All Files (*.*)'},'Pick an image');
if isequal(filename,0) || isequal(pathname,0),
return;
end
axes(handles.axes_org);
fpath=[pathname filename];
%imshow(imread(fpath));
img_src=imread(fpath);
imshow(img_src);
setappdata(handles.figure_pjimage,'img_src',img_src);
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%cla(axes_org);
m=0;n=0;
radio33=get(handles.radiobutton_33,'Value');
radio55=get(handles.radiobutton_55,'Value');
radio77=get(handles.radiobutton_77,'Value');
radio99=get(handles.radiobutton_99,'Value');
if radio33==1
m=3;n=3;
elseif radio55==1
m=5;n=5;
elseif radio77==1
m=7;n=7;
elseif radio99==1
m=9;n=9;
end
radioJY=get(handles.radiobutton_jy,'Value');
radioGS=get(handles.radiobutton_gs,'Value');
radioCT=get(handles.radiobutton_ct,'Value');
radioZSY=get(handles.radiobutton_zsy,'Value');
img_src=getappdata(handles.figure_pjimage,'img_src');
if radioJY==1
img_save=imnoise(img_src,'salt & pepper',0.05);
axes(handles.axes_deal);
cla reset;
imshow(img_save);
setappdata(handles.figure_pjimage,'img_save',img_save);
elseif radioGS==1
img_save=imnoise(img_src,'gaussian',0.15);
axes(handles.axes_deal);
cla reset;
imshow(img_save);
setappdata(handles.figure_pjimage,'img_save',img_save);
elseif radioCT==1
img_save=medfilt2(img_src,[m n]);
axes(handles.axes_deal);
cla reset;
imshow(img_save);
setappdata(handles.figure_pjimage,'img_save',img_save);
elseif radioZSY==1
img_save=adpmedian(img_src,[m n]);
axes(handles.axes_deal);
cla reset;
imshow(img_save);
setappdata(handles.figure_pjimage,'img_save',img_save);
end
% --- Executes on button press in pushbutton4.
function pushbutton_save_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%[filename, pathname] = uiputfile({'*.bmp','BMP files';'*.jpg','JPG files'},'Pick an Image');
[filename, pathname, filterindex] = uiputfile( ...
{'*.jpg','JPG-files (*.jpg)'; ...
'*.bmp','BMP-files (*.bmp)';}, ...
'Save as');
if isequal(filename,0) || isequal(pathname,0)
return;
else
fpath = fullfile(pathname, filename);
end
%img_src=getappdata(handles.figure_pjimage,'img_src');
%img_src=imread('E:\MATLAB7\work\11.jpg');
img_save=getappdata(handles.figure_pjimage,'img_save');
imwrite(img_save,fpath);
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(handles.figure_pjimage);
% --- Executes during object creation, after setting all properties.
function uipanel2_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanel2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function figure_pjimage_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure_pjimage (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
% --- Executes on button press in radiobutton_jy.
function radiobutton_jy_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton_jy (see GCBO)
% eventdata reserved - to be defined in a futu