GUI CREATION

:
function varargout = ImageFilter(varargin) % IMAGEFILTER M-file for ImageFilter.fig % IMAGEFILTER, by itself, creates a new IMAGEFILTER or raises the existing % singleton*. % % H = IMAGEFILTER returns the handle to a new IMAGEFILTER or the handle to % the existing singleton*. % % IMAGEFILTER('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in IMAGEFILTER.M with the given input arguments. % % IMAGEFILTER('Property','Value',...) creates a new IMAGEFILTER or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before ImageFilter_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to ImageFilter_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 ImageFilter % Last Modified by GUIDE v2.5 16-Mar-2011 20:34:42 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @ImageFilter_OpeningFcn, ... 'gui_OutputFcn', @ImageFilter_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 ImageFilter is made visible. function ImageFilter_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure

% --.output = hObject. function varargout = ImageFilter_OutputFcn(hObject. handles). % Update handles structure guidata(hObject. % --.to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to ImageFilter (see VARARGIN) % Choose default command line output for ImageFilter handles. % --.Executes on button press in pushbutton1. see OutputFcn. function varargout = ImageFilter_OutputFcn(hObject. .Outputs from this function are returned to the command line. function ImageFilter_OpeningFcn(hObject.figure1). handles). eventdata.Executes just before ImageFilter is made visible.to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA) command line arguments to ImageFilter (see VARARGIN) % Choose default command line output for ImageFilter handles. eventdata. % UIWAIT makes ImageFilter wait for user response (see UIRESUME) % uiwait(handles. % Update handles structure guidata(hObject. varargin) % This function has no output args.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 pushbutton1.figure1).Outputs from this function are returned to the command line. % --. handles) % varargout cell array for returning output args (see VARARGOUT). handles. eventdata.output.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.% eventdata % handles % varargin reserved . % UIWAIT makes ImageFilter wait for user response (see UIRESUME) % uiwait(handles. % hObject handle to figure % eventdata reserved . % hObject handle to figure % eventdata reserved . handles) % varargout cell array for returning output args (see VARARGOUT). --. % hObject handle to figure % eventdata reserved .output = hObject.

to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close ImageFilter.jpeg)'}. guidata(hObject.'Select Image').to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) img=handles.axes2).jpeg'.jpg.pgm'.'Message').handles).count=1. axes(handles.SELCTION OF IMAGE : function pushbutton19_Callback(hObject. %------------------------------------------------------------else Close GUI: --. handles) % hObject handle to pushbutton19 (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.axes4).Executes on button press in pushbutton33. handles) % hObject handle to pushbutton33 (see GCBO) % eventdata reserved . axes(handles. imshow(im).'speckle'). errordlg('Select a image'.img=img. function pushbutton33_Callback(hObject. eventdata.Executes on button press in pushbutton20.flag4=1. eventdata.pathname]=uigetfile({'*. handles.*.'Error').image=im.namefile)).handles). guidata(hObject.*.jpg. im=imnoise(img. end handles. title('Image added with noise') FILTER SELECTION: .pgm)'}. handles) % hObject handle to pushbutton20 (see GCBO) % eventdata reserved . handles. function pushbutton20_Callback(hObject.'Select an Image'). if namefile~=0 [img. eventdata.'FileType(*.handles). warndlg('IMAGE SELECTED'.map]=imread(strcat(pathname.*.bmp.img. guidata(hObject.*.'IMAGE Files (*.flag2=1. handles. ADD THE NOISE TO IMAGE: % --. imshow(img). handles. %----------------------------------------------------------------[namefile.

'Position'.Wiener Filter selection in GUI: function pushbutton7_Callback(hObject. imshow(j). eventdata. []).^ 2. % Calculate PSNR (Peak Signal to noise ratio). % Maximize figure. subplot(2. 0.image=j. []). title('MSE Image'). noisyImage = imnoise(grayImage. 'gaussian'. imshow(grayImage. subplot(2.flag3=1. j=wiener2(im. handles) % hObject handle to pushbutton7 (see GCBO) % eventdata reserved . mse = sum(sum(mseImage)) / (rows * columns).[5 5]). [rows columns] = size(grayImage).img. 2). title('Noisy Image'). 2.'Screensize')). set(gcf. im=imnoise(img1.handles). subplot(2. guidata(hObject.001). . Error Calculations in Image noise reductions: grayImage = j. 1). handles. title('Original Grey Scale Image'). mseImage = (double(grayImage) . imshow(noisyImage. % Calculate mean square error. get(0. 2. figure.axes3).to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) img1=handles. 3). imshow(mseImage. 0.double(noisyImage)) .'speckle'). % Add noise to it. title('WIENER FILTER OUTPUT'). []). 2. handles. axes(handles. PSNR = 20 * log10( 256^2 / mse^2).

Sign up to vote on this title
UsefulNot useful