A-4
Pengenalan=imreadNamaFile figure;imshowPengenalan;
title Gambar hasil pengenalan dari gambar uji
end if
din35 din=40 NamaFile=[
num2str8 sample num2strdin-36+1,
.jpg ]
Pengenalan=imreadNamaFile figure;imshowPengenalan;
title Gambar hasil pengenalan dari gambar uji
end if
din40 din=45 NamaFile=[
num2str9 sample num2strdin-41+1,
.jpg ]
Pengenalan=imreadNamaFile figure;imshowPengenalan;
title Gambar hasil pengenalan dari gambar uji
end if
din45 din=50 NamaFile=[num2str10 sample
num2strdin-46+1, .jpg
] Pengenalan=imreadNamaFile
figure;imshowPengenalan; title
Gambar hasil pengenalan dari gambar uji end
end
3. Program GUI untuk Pengujian
function pushbutton1_CallbackhObject, eventdata, handles
hObject handle to pushbutton1 see GCBO eventdata reserved - to be defined in a future version of MATLAB
handles structure with handles and user data see GUIDATA load
ListFileInd.mat CitraUji=handles.img;
T=dctmtx8; dct=block_struct Tblock_struct.dataT;
CitraUji=blockprocCitraUji,[8 8],dct; for
X=1:15 for
Y=1:15 U=X-18;V=Y-18;
U=U+1;V=V+1 FiturUjiX,Y=CitraUjiU,V
end ;
end ;
VektorFiturUji=FiturUji; x=VektorFiturUji;
d=1; for
i=1:15 for
j=1:15 temp1,d=xi,j
d=d+1
A-5
end end
VektorFiturUji=temp for
klaster=1:50 dklaster=sqrtsumListFileIndklaster,:-
VektorFiturUji.2 if
klaster==1 dmin=dklaster;
din=klaster; end
if klaster1dmindklaster
dmin=dklaster; din=klaster;
end end
nilai_slider=handles.slide; if
dmin nilai_slider acc=imread
TidakDikenali.jpg axeshandles.axes2
imshowacc sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Tidak_Dikenali
else sample=
-IMG- if
din=5 NamaFile=[
num2str1 sample num2strdin-
1+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Dikenali
end if
din5 din=10 NamaFile=[
num2str2 sample num2strdin-
6+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Dikenali
end if
din10 din=15 NamaFile=[
num2str3 sample num2strdin-
11+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
A-6
sethandles.edit4, string
, Dikenali
end if
din15 din=20 NamaFile=[
num2str4 sample num2strdin-
16+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Dikenali
end if
din20 din=25 NamaFile=[
num2str5 sample num2strdin-
21+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Dikenali
end if
din25 din=30 NamaFile=[
num2str6 sample num2strdin-
26+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Dikenali
end if
din30 din=35 NamaFile=[
num2str7 sample num2strdin-
31+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Dikenali
end if
din35 din=40 NamaFile=[
num2str8 sample num2strdin-
36+1, .jpg
] Pengenalan=imreadNamaFile
axeshandles.axes2 imshowPengenalan
sethandles.edit2, string
,NamaFile sethandles.edit3,
string ,dmin
sethandles.edit4, string
, Dikenali
end
A-7
if din40 din=45
NamaFile=[ num2str9 sample
num2strdin- 41+1,
.jpg ]
Pengenalan=imreadNamaFile axeshandles.axes2
imshowPengenalan sethandles.edit2,
string ,NamaFile
sethandles.edit3, string
,dmin sethandles.edit4,
string ,
Dikenali end
if din45 din=50
NamaFile=[num2str10 sample num2strdin-46+1,
.jpg ]
Pengenalan=imreadNamaFile axeshandles.axes2
imshowPengenalan sethandles.edit2,
string ,NamaFile
sethandles.edit3, string
,dmin sethandles.edit4,
string ,
Dikenali end
end --- Executes on button press in pushbutton2.
function pushbutton2_CallbackhObject, 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 [x y]=uigetfile
.jpg ;
imagex=imreadfullfiley,x; imagex=imresizeimagex,[120 120]
imagex=rgb2grayimagex imagex=im2doubleimagex
axeshandles.axes1 imshowimagex
sethandles.edit5, string
,x handles.img=imagex;
guidatahObject,handles --- Executes on button press in pushbutton4.
function pushbutton4_CallbackhObject, 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 fig = handles.figure1;
closefig function
edit2_CallbackhObject, eventdata, handles hObject handle to edit2 see GCBO
eventdata reserved - to be defined in a future version of MATLAB
A-8
handles structure with handles and user data see GUIDATA Hints: gethObject,String returns contents of edit2 as text
str2doublegethObject,String returns contents of edit2 as a double
--- Executes during object creation, after setting all properties. function
edit2_CreateFcnhObject, eventdata, handles hObject handle to edit2 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 isequalgethObject, BackgroundColor
, get0,
defaultUicontrolBackgroundColor sethObject,
BackgroundColor ,
white ;
end
function edit3_CallbackhObject, eventdata, handles
hObject handle to edit3 see GCBO eventdata reserved - to be defined in a future version of MATLAB
handles structure with handles and user data see GUIDATA Hints: gethObject,String returns contents of edit3 as text
str2doublegethObject,String returns contents of edit3 as a double
--- Executes during object creation, after setting all properties. function
edit3_CreateFcnhObject, eventdata, handles hObject handle to edit3 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 isequalgethObject, BackgroundColor
, get0,
defaultUicontrolBackgroundColor sethObject,
BackgroundColor ,
white ;
end
A-9
--- Executes on slider movement. function
slider1_CallbackhObject, eventdata, handles hObject handle to slider1 see GCBO
eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data see GUIDATA
slider_value=gethandles.slider1, value
sethandles.slider1, value
; nilai_slider=roundgethandles.slider1,
value ;
sethandles.edit1, string
,num2strnilai_slider; handles.slide=nilai_slider;
guidatahObject,handles Hints: gethObject,Value returns position of slider
gethObject,Min and gethObject,Max to determine range of slider
--- Executes during object creation, after setting all properties. function
slider1_CreateFcnhObject, eventdata, handles hObject handle to slider1 see GCBO
eventdata reserved - to be defined in a future version of MATLAB handles empty - handles not created until after all CreateFcns
called Hint: slider controls usually have a light gray background.
if isequalgethObject,
BackgroundColor ,
get0, defaultUicontrolBackgroundColor
sethObject, BackgroundColor
,[.9 .9 .9]; end
function edit1_CallbackhObject, eventdata, handles
hObject handle to edit1 see GCBO eventdata reserved - to be defined in a future version of MATLAB
handles structure with handles and user data see GUIDATA Hints: gethObject,String returns contents of edit1 as text
str2doublegethObject,String returns contents of edit1 as a double
--- Executes during object creation, after setting all properties. function
edit1_CreateFcnhObject, eventdata, handles hObject handle to edit1 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.
A-10
if ispc isequalgethObject,
BackgroundColor ,
get0, defaultUicontrolBackgroundColor
sethObject, BackgroundColor
, white
; end
--- Executes on button press in pushbutton5. function
pushbutton5_CallbackhObject, 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
closegcbf GUITA
function edit4_CallbackhObject, eventdata, handles
hObject handle to edit4 see GCBO eventdata reserved - to be defined in a future version of MATLAB
handles structure with handles and user data see GUIDATA Hints: gethObject,String returns contents of edit4 as text
str2doublegethObject,String returns contents of edit4 as a double
--- Executes during object creation, after setting all properties. function
edit4_CreateFcnhObject, eventdata, handles hObject handle to edit4 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 isequalgethObject, BackgroundColor
, get0,
defaultUicontrolBackgroundColor sethObject,
BackgroundColor ,
white ;
end function
edit5_CallbackhObject, eventdata, handles hObject handle to edit5 see GCBO
eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data see GUIDATA
Hints: gethObject,String returns contents of edit5 as text str2doublegethObject,String returns contents of edit5
as a double
A-11
--- Executes during object creation, after setting all properties. function
edit5_CreateFcnhObject, eventdata, handles hObject handle to edit5 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 isequalgethObject, BackgroundColor
, get0,
defaultUicontrolBackgroundColor sethObject,
BackgroundColor ,
white ;
end
LAMPIRAN B KUMPULAN CITRA
B-1
Orang Ke Citra Ke
1. Citra Referensi 01