Vous êtes sur la page 1sur 8

TUGAS PENGOLAHAN CITRA DIGITAL ( HISTOGRAM EQUALIZATION)

Disusun Oleh : Fadmi Rina (3095111226)

PROGRAM STUDI TEKNIK INFORMATIKA FAKULTAS TEKNOLOGI INFORMASI & BISNIS UNIVERSITAS TEKNOLOGI YOGYAKARTA 2012

1. APLIKASI HISTOGRAM EQUALIZATION MENGGUNAKAN GUI MATLAB

a. Desain Interface

b. Run Program

c. Buka File Citra

c d. Proses Histogram Equalization

e. Menyimpan Citra baru

f.

Menutup Aplikasi

2. SOURCE CODE

function varargout = HISTEQ(varargin) % HISTEQ M-file for HISTEQ.fig % HISTEQ, by itself, creates a new HISTEQ or raises the existing % singleton*. % % H = HISTEQ returns the handle to a new HISTEQ or the handle to % the existing singleton*. % % HISTEQ('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in HISTEQ.M with the given input arguments. % % HISTEQ('Property','Value',...) creates a new HISTEQ or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before HISTEQ_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to HISTEQ_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 HISTEQ % Last Modified by GUIDE v2.5 27-Oct-2012 21:06:49

% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @HISTEQ_OpeningFcn, ... 'gui_OutputFcn', @HISTEQ_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 HISTEQ is made visible. function HISTEQ_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 HISTEQ (see VARARGIN) % Choose default command line output for HISTEQ handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes HISTEQ wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = HISTEQ_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 buka. function buka_Callback(hObject, eventdata, handles) [nama_file1,nama_path1]=uigetfile(... {'*.bmp;*.jpg;*.jpeg','File Citra(*.bmp,*.jpg,*.jpeg)'; '*.bmp','File Bitmap(*.bmp)';... '*.jpg','File jpg(*.jpg)';... '*.jpeg','File jpeg(*.jpeg)'},... 'Buka File Citra');

if ~isequal(nama_file1, 0) citra=imread(fullfile(nama_path1,nama_file1)); handles.citra=citra; guidata(hObject,handles); axes(handles.axes1); imshow(handles.citra); else return; end % hObject handle to buka (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in proses. function proses_Callback(hObject, eventdata, handles) citra=handles.citra; citra=rgb2gray(citra); newcitra=histeq(citra); axes(handles.axes3);%perubahan citra dr rgb menjadi grayscale imshow(citra); axes(handles.axes5);%histogram citra asli imhist(citra); axes(handles.axes4);%citra baru (hasil dari histogram equalization imshow(newcitra); axes(handles.axes6);%histogram citra baru imhist(newcitra);

% hObject % eventdata % handles

handle to simpan (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

% --- Executes on button press in keluar. function keluar_Callback(hObject, eventdata, handles) button = questdlg('Tutup Aplikasi ?',... 'Tutup','Ya','Tidak','Ya'); if strcmp(button,'Tidak') return; end delete(handles.figure1); function simpan_Callback(hObject, eventdata, handles) [nama_file_simpan, path_simpan]=uiputfile(... {'*.bmp','file citra (*.bmp)'; '*.bmp','citra bmp (*.bmp)';... '*.*','Semua File(*.*)'},... 'Menyimpan File Citra Hasil Enkripsi'); if isequal([nama_file_simpan,path_simpan],[0,0])

else

return newcitra=handles.newcitra; file=fullfile(path_simpan,nama_file_simpan); imwrite(newcitra,file,'bmp'); handles.file=file; guidata(hObject,handles);

end

% hObject % eventdata % handles

handle to keluar (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

Vous aimerez peut-être aussi