LAMPIRAN A: LISTING PROGRAM function varargout = FigUtama(varargin) % FIGUTAMA M-file for FigUtama.fig % FIGUTAMA, by itself, creates a new FIGUTAMA or raises the % existing % singleton*. % % H = FIGUTAMA returns the handle to a new FIGUTAMA or the % handle to % the existing singleton*. % % FIGUTAMA('CALLBACK',hObject,eventData,handles,...) calls % the local % function named CALLBACK in FIGUTAMA.M with the given input % arguments. % % FIGUTAMA('Property','Value',...) creates a new FIGUTAMA or % raises the % existing singleton*. Starting from the left, property % value pairs are % applied to the GUI before FigUtama_OpeningFunction gets % called. An % unrecognized property name or invalid value makes property % application % stop. All inputs are passed to FigUtama_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 FigUtama % Last Modified by GUIDE v2.5 22-Oct-2010 02:00:19 % Begin initialization code - DO NOT EDIT if nargin == 0 % LAUNCH GUI fig = openfig(mfilename,'reuse'); % Use system color scheme for figure: set(fig,'color',get(0,'defaultuicontrolbackgroundcol % Generate a structure of handles to pass to callbacks, and % store it. handles = guihandles(fig); guidata(fig, handles); if nargout > 0 varargout{1} = fig; if ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try if (nargout) [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard feval(varargin{:}); % FEVAL switchyard
catch disp(lasterr); % End initialization code - DO NOT EDIT % --- Executes just before FigUtama is made visible. function FigUtama_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hobject handle to figure % varargin command line arguments to FigUtama (see VARARGIN) % Choose default command line output for FigUtama handles.output = hobject; % Update handles structure guidata(hobject, handles); % UIWAIT makes FigUtama wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = FigUtama_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hobject handle to figure % Get default command line output from handles structure varargout{1} = handles.output; function enode_layar_tersembunyi_callback(hobject, eventdata, handles) % hobject handle to enode_layar_tersembunyi (see GCBO) % Hints: get(hobject,'string') returns % contents of enode_layar_tersembunyi as text % str2double(get(hobject,'string')) returns % contents of enode_layar_tersembunyi as a double % properties. function enode_layar_tersembunyi_createfcn(hobject, eventdata, handles) % hobject handle to enode_layar_tersembunyi (see GCBO)
% handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. function ekonstanta_belajar_callback(hobject, eventdata, handles) % hobject handle to ekonstanta_belajar (see GCBO) % Hints: get(hobject,'string') returns contents of % ekonstanta_belajar as text % str2double(get(hobject,'string')) returns contents of % ekonstanta_belajar as a double % properties. function ekonstanta_belajar_createfcn(hobject, eventdata, handles) % hobject handle to ekonstanta_belajar (see GCBO) % handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. function edit3_callback(hobject, eventdata, handles) % hobject handle to edit3 (see GCBO) % Hints: get(hobject,'string') returns contents of edit3 as text % str2double(get(hobject,'string')) returns contents of % edit3 as a double properties. function edit3_createfcn(hobject, eventdata, handles) % hobject handle to edit3 (see GCBO) % handles empty - handles not created until after all
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. function ebesar_galat_callback(hobject, eventdata, handles) % hobject handle to ebesar_galat (see GCBO) % Hints: get(hobject,'string') returns contents of ebesar_galat as % text % str2double(get(hobject,'string')) returns contents of % ebesar_galat as a double % properties. function ebesar_galat_createfcn(hobject, eventdata, handles) % hobject handle to ebesar_galat (see GCBO) % handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. function ebatas_iterasi_callback(hobject, eventdata, handles) % hobject handle to ebatas_iterasi (see GCBO) % Hints: get(hobject,'string') returns contents of ebatas_iterasi % as text % str2double(get(hobject,'string')) returns contents of % ebatas_iterasi as a double % properties. function ebatas_iterasi_createfcn(hobject, eventdata, handles) % hobject handle to ebatas_iterasi (see GCBO) % handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. % --- Executes on button press in btn_buka. function btn_buka_callback(hobject, eventdata, handles) % hobject handle to btn_buka (see GCBO) proyek=guidata(gcbo); [namafile, direktori] = uigetfile({'*.bmp';'*.jpg';'*.gif';'*.*'}, 'Buka Gambar'); if isequal(namafile,0) return; S = imread([direktori,namafile]); axes(handles.axes1); imshow(s); handles.s = S; set(proyek.text_nama,'string',namafile); set(proyek.text_panjang,'string',size(s,1)); set(proyek.text_lebar,'string',size(s,2)); guidata(hobject, handles); % --- Executes on button press in btn_latih. function btn_latih_callback(hobject, eventdata, handles) % hobject handle to btn_latih (see GCBO) clc; proyek=guidata(gcbo); load('target.txt'); for i = 1:100 TrainImages=imread(strcat('Latih','\', (strcat(num2str(i),'.bmp')))); patterns = img_preprocess(trainimages); out(:,i) = patterns; S2 = str2double(get(proyek.enode_layar_tersembunyi,'string')); eta = str2double(get(proyek.ekonstanta_belajar,'string')); tol = str2double(get(proyek.ebesar_galat,'string')); iter = str2double(get(proyek.ebatas_iterasi,'string')); p = out(:,1:i); %nilai masukan t=target; t= t'; % nilai keluaran yang diinginkan %Pembuatan dan Pelatihan Jaringan Saraf Tiruan dengan Propagasi %Balik [S1,Q] = size(p); [S3,Q] = size(t);
net = newff(minmax(p),[s2 S3],{'logsig' 'logsig' },'traingd'); %inisialisasi jaringan net.iw{1,1} = net.iw{1,1}*0.05; %inisialisasi bobot masukan %dengan nilai acak (-0.5) - (0.5) net.b{1} = net.b{1}*0.05; %inisialisasi bobot bias %masukan dengan nilai acak (-0.5) - (0.5) net.lw{2,1} = net.lw{2,1}*0.05; %inisialisasi bobot %tersembunyi-keluaran dengan %nilai acak (-0.5) - (0.5) net.b{2} = net.b{2}*0.05; %inisialisasi bobot bias %tersembunyi-keluaran dengan %nilai acak (-0.5) - (0.5) net.performfcn = 'mse'; net.trainparam.goal = tol; %batas nilai MSE/toleransi error net.trainparam.lr = eta; %konstanta pembelajaran net.trainparam.show = 20; %selang tampilan net.trainparam.epochs = iter; %maksimum iterasi/epoch [net,tr] = train(net,p,t); handles.net = net; assignin('base','net',net); guidata(hobject, handles); % --- Executes on button press in btn_keluar. function btn_keluar_callback(hobject, eventdata, handles) % hobject handle to btn_keluar (see GCBO) close; % --- Executes on button press in btnsimpan. function btnsimpan_callback(hobject, eventdata, handles) % hobject handle to btnsimpan (see GCBO) net = handles.net ; save bobotakhir net; guidata(hobject, handles); % --- Executes on button press in btn_pengenalan. function btn_pengenalan_callback(hobject, eventdata, handles) % hobject handle to btn_pengenalan (see GCBO) clc; load bobotakhir; proyek=guidata(gcbo); S = handles.s; axes(handles.axes1); patterns=img_preprocess(s); patterns=patterns'; [result] = sim(net,patterns); r=round(result); if r==[0; 0; 0; 1]
msgbox('dikenal Sebagai Tanda Tangan SARI','Hasil Pengujian'); if r==[0; 0; 1; 0] msgbox('dikenal Sebagai Tanda Tangan SELLI','Hasil Pengujian'); if r==[0; 0; 1; 1] msgbox('dikenal Sebagai Tanda Tangan UTRI','Hasil Pengujian'); if r==[0; 1; 0; 0] msgbox('dikenal Sebagai Tanda Tangan EWID','Hasil Pengujian'); if r==[0; 1; 0; 1] msgbox('dikenal Sebagai Tanda Tangan BENNI','Hasil Pengujian'); if r==[0; 1; 1; 0] msgbox('dikenal Sebagai Tanda Tangan DESI','Hasil Pengujian'); if r==[0; 1; 1; 1] msgbox('dikenal Sebagai Tanda Tangan ANDRIANY','Hasil Pengujian'); if r==[1; 0; 0; 0] msgbox('dikenal Sebagai Tanda Tangan ARNEN','Hasil Pengujian'); if r==[1; 0; 0; 1] msgbox('dikenal Sebagai Tanda Tangan DEDI','Hasil Pengujian'); if r==[1; 0; 1; 0] msgbox('dikenal Sebagai Tanda Tangan ELLEN','Hasil Pengujian'); msgbox('tanda Tangan Diluar Database','Hasil Pengujian'); guidata(hobject, handles); function ekolom_callback(hobject, eventdata, handles) % hobject handle to ekolom (see GCBO) % Hints: get(hobject,'string') returns contents of ekolom as text % str2double(get(hobject,'string')) returns contents of % ekolom as a double % properties. function ekolom_createfcn(hobject, eventdata, handles) % hobject handle to ekolom (see GCBO) % handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
function ebaris_callback(hobject, eventdata, handles) % hobject handle to ebaris (see GCBO) % Hints: get(hobject,'string') returns contents of ebaris as text % str2double(get(hobject,'string')) returns contents of % ebaris as a double % properties. function ebaris_createfcn(hobject, eventdata, handles) % hobject handle to ebaris (see GCBO) % handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. function edit14_callback(hobject, eventdata, handles) % hobject handle to edit14 (see GCBO) % Hints: get(hobject,'string') returns contents of edit14 as text % str2double(get(hobject,'string')) returns contents of % edit14 as a double % properties. function edit14_createfcn(hobject, eventdata, handles) % hobject handle to edit14 (see GCBO) % handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. function edesired_out2_callback(hobject, eventdata, handles) % hobject handle to edesired_out2 (see GCBO)
% Hints: get(hobject,'string') returns contents of edesired_out2 % as text % str2double(get(hobject,'string')) returns contents of % edesired_out2 as a double % properties. function edesired_out2_createfcn(hobject, eventdata, handles) % hobject handle to edesired_out2 (see GCBO) % handles empty - handles not created until after all % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. % --- Executes on button press in btn_uji_memorisasi. function btn_uji_memorisasi_callback(hobject, eventdata, handles) % hobject handle to btn_uji_memorisasi (see GCBO) clear all; clc; load bobotakhir; load('target.txt'); for i = 1:100 TestImages=imread(strcat('Latih','\', (strcat(num2str(i),'.bmp')))); patterns = img_preprocess(testimages); out(:,i) = patterns; p = out(:,1:i); %nilai masukan t=target; t= t'; % nilai keluaran yang diinginkan [n,n]= size(p); [result] = sim(net,p); r=round(result); benar=0; for i=1:n Hasil=r(:,i); Target=t(:,i); if Hasil==Target disp(['data ke-',num2str(i),' = BENAR']); fprintf('hasil Keluarannya =\n'); %Hasil keluaran jaringan fprintf('%9.0f\n',hasil); fprintf('\n'); benar=benar+1;
disp(['data ke-',num2str(i),' = SALAH']); fprintf('hasil Keluarannya =\n'); %Hasil keluaran jaringan fprintf('%9.0f\n',hasil); fprintf('\n'); persen=(benar/n)*100; disp(['banyak Data =>' num2str(n)]); disp(['jumlah Yang Benar =>' num2str(benar)]); disp(['persentase Kebenaran Memorisasi =>' num2str(persen) '%']); % --- Executes on button press in btn_uji_generalisasi. function btn_uji_generalisasi_callback(hobject, eventdata, handles) % hobject handle to btn_uji_generalisasi (see GCBO) clear all; clc; load bobotakhir; load('target_uji.txt'); for i = 1:50 TestImages=imread(strcat('Uji','\', (strcat(num2str(i),'.bmp')))); patterns = img_preprocess(testimages); out(:,i) = patterns; p = out(:,1:i); % nilai masukan t=target_uji; t= t'; % nilai keluaran yang diinginkan [n,n]= size(p); [result] = sim(net,p); r=round(result); benar=0; for i=1:n Hasil=r(:,i); Target=t(:,i); if Hasil==Target disp(['data ke-',num2str(i),' = BENAR']); fprintf('hasil Keluarannya =\n'); %Hasil keluaran jaringan fprintf('%9.0f\n',hasil); fprintf('\n'); benar=benar+1; disp(['data ke-',num2str(i),' = SALAH']); fprintf('hasil Keluarannya =\n'); %Hasil keluaran jaringan fprintf('%9.0f\n',hasil); fprintf('\n'); persen=(benar/n)*100; disp(['banyak Data =>' num2str(n)]); disp(['jumlah Yang Benar =>' num2str(benar)]);
disp(['persentase Kebenaran Generalisasi =>' num2str(persen) '%']); % FUNGSI PRAPENGOLAHAN function img_ekstraksi = img_preprocess(s) Igray = rgb2gray(s); Ibw = im2bw(igray,graythresh(igray)); bw2 = edu_imgcrop(ibw); img_ekstraksi = img_ekstrak(bw2); % FUNGSI MEMOTONG CITRA function bw2 = edu_imgcrop(ibw) [y2temp x2temp] = size(ibw); x1=1; y1=1; x2=x2temp; y2=y2temp; % Menentukan batas kiri cntb=1; while (sum(ibw(:,cntb))==y2temp) x1=x1+1; cntb=cntb+1; % Menentukan batas kanan cntb=1; while (sum(ibw(cntb,:))==x2temp) y1=y1+1; cntb=cntb+1; % Menentukan batas atas cntb=x2temp; while (sum(ibw(:,cntb))==y2temp) x2=x2-1; cntb=cntb-1; % Menentukan batas bawah cntb=y2temp; while (sum(ibw(cntb,:))==x2temp) y2=y2-1; cntb=cntb-1; % Memotong citra sesuai batas bw2=imcrop(ibw,[x1,y1,(x2-x1),(y2-y1)]);
% FUNGSI MENGUBAH UKURAN CITRA BINER MENJADI 200X300 DAN % MENGUBAHNYA MENJADI MATRIKS 20X30 (EKSTRAKSI CIRI) function lett = img_ekstrak(bw2) img_resize=imresize(bw2,[200,300]); for cnt=1:20 for cnt2=1:30 Atemp=sum(img_resize((cnt*10-9:cnt*10),(cnt2*10-9:cnt2*10))); if Atemp < 10 Atemp = 1; Atemp = 0; lett((cnt-1)*30+cnt2)=sum(atemp);
LAMPIRAN B: HASIL SCANNING TANDA TANGAN 1. Tanda Tangan yang Dilatih NAMA TANDA TANGAN S A R I S E L L I U T R I E W I D
NAMA B E N N I TANDA TANGAN D E S I A N D R I A N Y A R N E N D E D I
NAMA E L L E N TANDA TANGAN 2. Tanda Tangan yang Diuji NAMA TANDA TANGAN SARI SELLI UTRI EWID BENNI
NAMA TANDA TANGAN DESI ANDRIANY ARNEN DEDI ELLEN