• Tidak ada hasil yang ditemukan

Bab 5 Penutup

5.2. Saran

Adapun saran untuk pengembangan selanjutnya adalah sebagai berikut:

a. Agar peneliti selanjutnya membandingkan dengan algoritma lain untuk segmentasi citra seperti algoritma K-means Clustering, Region Splitting, Region Growing dan lain sebagainya.

b. Agar peneliti selanjutnya menggunakan format file yang berbeda selain JPG dan BMP.

DAFTAR PUSTAKA

[1] Ahmad, U. 2005. Pengolahan Citra Digital dan Teknik Pemrogramannya. Yogyakarta. Penerbit: Graha Ilmu.

[2] Basuki, A. 2005. Pengolahan Citra Digital Menggunakan Visual Basic, Penerbit Graha Ilmu. Jakarta.

[3] Beatriz D. 2004. Experiment in Image Segmentation for Automatic US License Plate Recognition, Faculty of the Virginia Polytechnic Institute and State University, Blacksburg, Virginia. International Journal.

[4] Gonzalez, R. 2002. Digital Image Processing. USA: Addison-Wesley Publishing Co, University of Tennessee.

[5] Munir, R. 2004. Pengolahan Citra Digital dengan Pendekatan Algoritmik, Bandung: Penerbit Informatika.

[6] _______. 2010. Aplikasi Image Thresholding untuk Segmentasi Objek, http://www.informatika.org/~rinaldi/Citra/Tugas1.pdf, akses Maret 2012.

[7] Murinto, Harjoko, Agus. 2009. Segmentasi Citra Menggunakan Watershed Dan Intensitas Filtering Sebagai Pre Processing. Seminar Nasional Informatika 2009 UPN ”Veteran” Yogyakarta, 23 Mei 2009.

[8] Putra, D. Pengolahan Citra Digital. Yogyakarta: Penerbit ANDI.

[9] Prasetyo, E. 2012. Pengolahan Citra digital Dan Aplikasinya Menggunakan Matlab. Yogyakarta: penerbit ANDI OFFSET.

[10] Sutoyo. T. 2009. Teori Pengolahan citra digital, Yogyakarta: Penerbit ANDI.

[11] Y. Deng, B. S. Manjunath. 2001. Unsupervised Segmentation of Color-Texture Regions in Images and Video, IEEE Transactions on Pattern Analysis and Machine Intelligence. International Journal.

LISTING PROGRAM Form Menu Utama

function varargout = menu(varargin) % MENU M-file for menu.fig

% MENU, by itself, creates a new MENU or raises the existing % singleton*.

%

% H = MENU returns the handle to a new MENU or the handle to % the existing singleton*.

%

% MENU('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in MENU.M with the given input arguments.

%

% MENU('Property','Value',...) creates a new MENU or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before menu_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application

% stop. All inputs are passed to menu_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 menu

% Last Modified by GUIDE v2.5 07-Dec-2012 11:38:29

% Begin initialization code - DO NOT EDIT gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @menu_OpeningFcn, ... 'gui_OutputFcn', @menu_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

% --- Executes just before menu is made visible.

function menu_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 menu (see VARARGIN)

% Choose default command line output for menu handles.output = hObject;

% Update handles structure guidata(hObject, handles);

% UIWAIT makes menu wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = menu_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 mu_Callback(hObject, eventdata, handles) % hObject handle to mu (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) menu

%

----function ab_Callback(hObject, eventdata, handles) % hObject handle to ab (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) About

%

----function quit_Callback(hObject, eventdata, handles) % hObject handle to quit (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

close all;

%

----function sg_Callback(hObject, eventdata, handles) % hObject handle to sg (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) segmen

Form Segmentasi

function varargout = segmen(varargin) % SEGMEN M-file for segmen.fig

% SEGMEN, by itself, creates a new SEGMEN or raises the existing

% singleton*. %

% H = SEGMEN returns the handle to a new SEGMEN or the handle to

% the existing singleton*. %

% SEGMEN('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in SEGMEN.M with the given input arguments.

%

% SEGMEN('Property','Value',...) creates a new SEGMEN or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before segmen_OpeningFcn gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to segmen_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 segmen

% Last Modified by GUIDE v2.5 07-Dec-2012 11:56:38

% Begin initialization code - DO NOT EDIT gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @segmen_OpeningFcn, ... 'gui_OutputFcn', @segmen_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 segmen is made visible.

function segmen_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 segmen (see VARARGIN)

% Choose default command line output for segmen handles.output = hObject;

% Update handles structure guidata(hObject, handles);

% UIWAIT makes segmen wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = segmen_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 load.

function load_Callback(hObject, eventdata, handles)

[FileName,PathName]=uigetfile({'*.bmp;*.jpg'},' Pilih file citra asli'); if~isequal (FileName,0) handles.data=(fullfile(PathName,FileName)); handles.data1=imread(handles.data); guidata(hObject,handles); axes(handles.axes1); imshow(handles.data1); end set (handles.nama,'string',FileName); m=imfinfo(handles.data); set (handles.wa,'String',m.Width); set (handles.ha,'String',m.Height);

% --- Executes on button press in thres.

function thres_Callback(hObject, eventdata, handles) citra=rgb2gray(handles.data1);

tic

[baris, kolom] = size(citra); citra = double(citra); ax1=max(max(citra)); in1=min(min(citra)); T=(ax1+in1)/2; for i = 1:baris for j = 1:kolom if citra(i, j) < T citraThresholding(i, j) = 0; else citraThresholding(i, j) = 1; end end end k= toc; set(handles.lat,'String',k); axes(handles.axes4); imshow(citraThresholding); imwrite(citraThresholding,'Thres.jpg'); s=imfinfo('Thres.jpg'); set(handles.ut,'String',s.FileSize/1024); set(handles.ht,'String',s.Height); set (handles.wt,'String',s.Width);

% --- Executes on button press in exit.

function exit_Callback(hObject, eventdata, handles) close

% --- Executes on button press in rm.

function rm_Callback(hObject, eventdata, handles) tic I = rgb2gray(handles.data1); I = im2double(I); [x y]= size(I); a = round(x/2); b = round(y/2); J = merging(I,a,b,0.2); guidata(hObject,handles); axes(handles.axes5); imshow(J); l= toc; set(handles.lar,'String',l); imwrite(J,'RegMer.jpg'); n=imfinfo('RegMer.jpg'); set(handles.ur,'String',n.FileSize/1024); set (handles.wr,'String',n.Width); set (handles.hr,'String',n.Height);

function nama_Callback(hObject, eventdata, handles) % hObject handle to nama (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of nama as text % str2double(get(hObject,'String')) returns contents of nama as a double

% --- Executes during object creation, after setting all properties.

function nama_CreateFcn(hObject, eventdata, handles) % hObject handle to nama (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function wa_CreateFcn(hObject, eventdata, handles) % hObject handle to wa (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function lat_CreateFcn(hObject, eventdata, handles) % hObject handle to lat (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function ut_CreateFcn(hObject, eventdata, handles) % hObject handle to ut (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

function ur_Callback(hObject, eventdata, handles) % hObject handle to ur (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of ur as text % str2double(get(hObject,'String')) returns contents of ur as a double

% --- Executes during object creation, after setting all properties.

function ur_CreateFcn(hObject, eventdata, handles) % hObject handle to ur (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

function wt_Callback(hObject, eventdata, handles) % hObject handle to wt (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of wt as text str2double(get(hObject,'String')) returns contents of wt as a double

% --- Executes during object creation, after setting all properties.

function wt_CreateFcn(hObject, eventdata, handles) % hObject handle to wt (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function wr_CreateFcn(hObject, eventdata, handles) % hObject handle to wr (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function lar_CreateFcn(hObject, eventdata, handles) % hObject handle to lar (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function ha_CreateFcn(hObject, eventdata, handles) % hObject handle to ha (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function ht_CreateFcn(hObject, eventdata, handles) % hObject handle to ht (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function hr_CreateFcn(hObject, eventdata, handles) % hObject handle to hr (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

end

% --- Executes when figure1 is resized.

function figure1_ResizeFcn(hObject, eventdata, handles) % hObject handle to figure1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

%

----function menu_Callback(hObject, eventdata, handles) menu

%

----function about_Callback(hObject, eventdata, handles) About

%

----function quit_Callback(hObject, eventdata, handles) close all

%

----function sg_Callback(hObject, eventdata, handles) segmen

% --- Executes on button press in clear.

function clear_Callback(hObject, eventdata, handles) % hObject handle to clear (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) cla(handles.axes1,'reset'); set(handles.axes1,'xtick',[],'ytick',[],'Xcolor','w','Ycolor','w') cla(handles.axes4,'reset'); set(handles.axes4,'xtick',[],'ytick',[],'Xcolor','w','Ycolor','w') cla(handles.axes5,'reset'); set(handles.axes5,'xtick',[],'ytick',[],'Xcolor','w','Ycolor','w') Form About

function varargout = About(varargin)

% Begin initialization code - DO NOT EDIT gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @About_OpeningFcn, ... 'gui_OutputFcn', @About_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 About is made visible.

function About_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject;

guidata(hObject, handles);

% --- Outputs from this function are returned to the command line. function varargout = About_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output;

% --- Executes on button press in Close.

function Tutup_Callback(hObject, eventdata, handles) close(gcbf)

Dokumen terkait