BAB 5 KESIMPULAN DAN SARAN
5.2. Saran
Untuk penelitian selanjutnya penulis menyarankan pengembangan sistem agar
dilakukan perbandingan dengan metode pengenalan wajah lainnya antara lain metode
DAFTAR PUSTAKA
Acharya, Tinku and Ajoy K. Ray, 2005, Image Processing Principles and
Applications, John Wiley and Sons, Inc. Hoboken, New Jersey.
Anil K, Jain, 1989, Fundamentals of Digital Image Processing, Prentice Hall
International.
Andrew S, Glassner, 1995, ”Principles of Digital Image Synthesis, Vol 1, Chapter 6”,
Morgan Kaufman Publishing.
Awcock, G,J, and Thomas, R, 1996, Aplikasi Proses Image, McGraw-Hill Inc,
Singapore.
Baxes, Gregory A, 1994, Proses Gambar Digital: Principles and Applications, John
Wiley & Sons, New York.
Cai, J, dan Goshtasby, A. 1991, Eigenfaces for Recognition. Image and Vision
Computing 18, J. of Cognitive Neuroscience.
Dana H, Ballard, 1982, Computer Vision, Prentice Hall.
Fagertun, Jeans, 2005, Face Recognitions, Master Thesis, Technical University of
Denmark.
Jain, Anil K., 1989, Fundamentals of Digital Image Processing, Prentice Hall
International.
Lewand, Robert Edward, 2000, Cryptological Mathematics, Mathematical
Association of America, New York.
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
43
Lim, Resmana, and M.J.T., Reinders, 2000, Facial Landmark Detection Using a
Gabor Filter Representation and a Genetic Search Algorithm, proceeding of
ASCI 2000 conference, Lommel Belgium.
Munir, Rinaldi. 2004. Pengolahan Citra Digital Dengan Pendekatan Algoritmik
Bandung : Penerbit Informatika, 2004. ISBN: 979-3338-29-6.
Robin, 2007, Sisem Pengolahan Citra dan Deteksi wajah pada Sistem Pengenalan
Wajah, Laporan Tugas Akhir, ITB.
Sarfraz, Muhammad, 2005, Computer Aided Intelligent Recognition Techniques and
Application, John Wiley and Sons.
Wiskott, L, Fellous, J.M., Kruger, N., and von der Malsburg, C, 1997, Face
Recognition by Elastic Bunch Graph Matching, IEEE Transaction on Pattern
LAMPIRAN A HASIL PENGENALAN WAJAH
1. Wajah mirip tetapi orang berbeda
No Wajah-1 Wajah-2 Kemiripan
1 42,5 %
2 43 %
3 43 %
4 42 %
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
45
2. Wajah sama tetapi mimik berbeda
No Wajah-1 Wajah-2 Kemiripan
1 45 %
2 89,49 %
3 75 %
4 40,5 %
5 95 %
3. Wajah sama tetapi atribut berbeda
No Wajah-1 Wajah-2 Kemiripan
1 90 %
2 75 %
3 34,5 %
4 43 %
5 33,5 %
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
47
4. Wajah sama tetapi pose berbeda
No Wajah-1 Wajah-2 Kemiripan
1 41,5 %
2 42 %
3 43,5 %
4 43,5 %
5 40 %
LAMPIRAN B LISTING PROGRAM
1. Login
Dim rsPasswd As Recordset Dim CN As Connection
Private Sub cmdCancel_Click() End
End Sub
Private Sub cmdOK_Click()
Set rsPasswd = New ADODB.Recordset
rsPasswd.Open "Select * from [User] where userId ='" & _
txtUid.Text & "' and passwd = '" & txtPass.Text & "'", CN, _ adOpenDynamic, adLockOptimistic
If rsPasswd.EOF = True Then MsgBox "Password salah" txtPass.Text = ""
txtPass.SetFocus Else
If (txtUid.Text) = "lestya" And txtPass.Text = "123" Then frmMenu.dtFoto.Enabled = True frmMenu.dtUser.Enabled = True frmMenu.Show Else frmMenu.dtFoto.Enabled = False frmMenu.dtUser.Enabled = False frmMenu.Show End If End If End Sub
Private Sub Form_Activate() cmdOk.Enabled = False
txtPass.Locked = True txtUid.Locked = False
lblDate.Caption = Format(Now, "dd-mm-yyyy") txtUid.SetFocus
End Sub
Private Sub Form_Load()
Set CN = New ADODB.Connection
CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; _ Data Source=" & App.Path & "\dbWajah.mdb"
CN.CursorLocation = adUseClient CN.Open
End Sub
Private Sub txtPass_Change() cmdOk.Enabled = True
End Sub
Private Sub txtPass_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
cmdOk.Enabled = True cmdOk.SetFocus
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
49
Private Sub txtUid_Change() txtPass.Locked = False End Sub
Private Sub txtUid_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtPass.Locked = False txtPass.SetFocus End If End Sub 2.MenuUtama Dim j As Integer
Private Sub abt_Click() frmAbout.Show
End Sub
Private Sub dtFoto_Click() frmDataFoto.Show
End Sub
Private Sub dtUser_Click() frmUser.Show
End Sub
Private Sub help_Click() frmHelp.Show
End Sub
Private Sub img_Click() FrmMain.Show
End Sub
Private Sub mnJst_Click() FrmKenalan.Show
End Sub
Private Sub quit_Click() End frmLogin.txtPass = "" frmLogin.txtUid = "" frmLogin.txtUid.SetFocus frmLogin.Show End Sub
Private Sub Timer1_Timer() Dim jud, jud1 As String
jud = "PENGENALAN WAJAH BERDASARKAN PENGOLAHAN" jud1 = "DENGAN METODE GABOR WAVELET"
Label1.Caption = Left(jud, j) Label2.Caption = Left(jud1, j) If j = 1 Then Label1.ForeColor = vbYellow ElseIf j > 10 Then Label1.ForeColor = vbYellow Else Label1.ForeColor = vbGreen
End If j = j + 1 If j > Len(jud) + 30 Then j = 1 End If End Sub 3. Pengenalan Option Base 1
Private rsCari As ADODB.Recordset Dim rsCari1 As Recordset
Private CN As ADODB.Connection
Private DataBaseConection As ADODB.Connection Private DataBaseRecorset As ADODB.Recordset Private m_strImagePath As String
Dim PrintCode(1 To 26) As String Dim h1(3, 3), h2(3, 3) As Single Dim Pixel Dim Pixel2 Dim Rred Dim Ggreen Dim Bblue Dim RR1 Dim GG1 Dim BB1 Dim RR2 Dim GG2 Dim BB2 Dim RR3 Dim GG3 Dim BB3 Dim Q As String Dim Q2 As String Dim Temp As Integer Dim Temp2 As Integer Dim XXX As Integer Dim YYY As Integer Dim XX As Integer Dim YY As Integer Dim RR As Integer Dim RG As Integer Dim RB As Integer Dim CurX Dim CurY Dim JB As Byte
Dim conServer As Connection Dim rsData As Recordset Dim rsHapus As Recordset Dim updFlags As Byte Dim Aksi As String * 1 Dim rsJumDt As Recordset Dim noPro As Integer
Dim strNama1 As String * 1 Dim strNama As String Dim bolScan As Boolean Dim bolHasil As Boolean Dim Pers As Single Dim TOtPers As Single
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
51
Sub Belajar() bolLajar = True
Set rsCari1 = New ADODB.Recordset
rsCari1.Open "Select * from Data where nama='" & TxtNama.Text _ & "'", CN, 1, 2
'Pre-Set all OutPut-Values to ZERO
G_A = 0: G_B = 0: G_C = 0: G_D = 0: G_E = 0: G_F = 0: G_G = 0: _ G_H = 0: G_I = 0: G_J = 0: G_K = 0: G_L = 0: G_M = 0
G_N = 0: G_O = 0: G_P = 0: G_Q = 0: G_R = 0: G_S = 0: G_T = 0: _ G_U = 0: G_V = 0: G_W = 0: G_X = 0: G_Y = 0: G_Z = 0
'Cycle through the 'Pixels' and set .tag to "1" if Pixels is a "X" For j = 1 To 25 If Piece(j).Text = "X" Then Piece(j).Tag = "1" Else Piece(j).Tag = "0" End If Next j
'Set The Output-Values to 1 if the Left-TExt shows its number If Text1.Text = "A" Then G_A = 1
If Text1.Text = "B" Then G_B = 1 If Text1.Text = "C" Then G_C = 1 If Text1.Text = "D" Then G_D = 1 If Text1.Text = "E" Then G_E = 1 If Text1.Text = "F" Then G_F = 1 If Text1.Text = "G" Then G_G = 1 If Text1.Text = "H" Then G_H = 1 If Text1.Text = "I" Then G_I = 1 If Text1.Text = "J" Then G_J = 1 If Text1.Text = "K" Then G_K = 1 If Text1.Text = "L" Then G_L = 1 If Text1.Text = "M" Then G_M = 1 If Text1.Text = "N" Then G_N = 1 If Text1.Text = "O" Then G_O = 1 If Text1.Text = "P" Then G_P = 1 If Text1.Text = "Q" Then G_Q = 1 If Text1.Text = "R" Then G_R = 1 If Text1.Text = "S" Then G_S = 1 If Text1.Text = "T" Then G_T = 1 If Text1.Text = "U" Then G_U = 1 If Text1.Text = "V" Then G_V = 1 If Text1.Text = "W" Then G_W = 1 If Text1.Text = "X" Then G_X = 1 If Text1.Text = "Y" Then G_Y = 1 If Text1.Text = "Z" Then G_Z = 1 a = 3000 'Iterations
For i = 1 To CLng(a)
If i Mod 100 = 0 Then DoEvents
'Insert the made Tag-Values of alle 25 'Pixels' into an Array _ myInput = Array(Piece(1).Tag, Piece(2).Tag, Piece(3).Tag,
Piece(4).Tag, Piece(5).Tag, Piece(6).Tag, Piece(7).Tag, Piece(8).Tag, Piece(9).Tag, Piece(10).Tag, Piece(11).Tag, Piece(12).Tag,
Piece(13).Tag, Piece(14).Tag, Piece(15).Tag, Piece(16).Tag, Piece(17).Tag, Piece(18).Tag, Piece(19).Tag, Piece(20).Tag, Piece(21).Tag, Piece(22).Tag, Piece(23).Tag, Piece(24).Tag, Piece(25).Tag)
myOutput = Array(G_A, G_B, G_C, G_D, G_E, G_F, G_G, G_H, _ G_I, G_J, G_K, G_L, G_M, G_N, G_O, G_P, G_Q, G_R, G_S, G_T, G_U, _ G_V, G_W, G_X, G_Y, G_Z) ' del
Call SupervisedTrain(myInput, myOutput) 'Run the Training Label14 = Int((i / a) * 100) & "%" 'Show the Progress
Next i End Sub
Private Sub cmdBatal_Click() lblMirip = "" TxtNama = "" lblNmFile = "" lblNama = "" lblNmPic1 = "" txtNmPic99 = "" selisih = 0 noPro = 0 Pers = 0 TOtPers = 0 s = 0 bolHasil = False Image1.Picture = Nothing Pic.Picture = Nothing PicA.Picture = Nothing PicB.Picture = Nothing Pic99.Picture = Nothing Pic1.Picture = Nothing prgss1.Visible = False txtNmPic1 = "" txtNmPic1.BackColor = &H80000005 List_Erg.Clear cmdProsesGray.Enabled = False cmdLoad.Enabled = True cmdLoad.SetFocus End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub cmdProsesGray_Click() cmdProsesGray.Enabled = False Dim w(500, 500) As Integer Dim X(500, 500) As Integer n1 = 0
On Error Resume Next
Set rsCari = New ADODB.Recordset
'rsCari.Open "Data", CN, adOpenStatic, adLockPessimistic, _ adCmdTable '
rsCari.Open "Select * from Data order by nama asc", CN, 1, 2 If Not rsCari.EOF = True Then
rsCari.MoveFirst
Do While Not rsCari.EOF = True
Set txtNmPic1.DataSource = rsCari Set Pic1.DataSource = rsCari
Set txtNmPic99.DataSource = rsCari Set Pic99.DataSource = rsCari Set lblNmPic1.DataSource = rsCari Progress
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
53
txtNmPic1.DataField = LCase("NamaFile") strNama = Left(txtNmPic1.Text, 1) lblNmPic1.DataField = "Nama" If rsCari.EOF Then Exit Do prgss1.Visible = False End IfIf bolHasil = False Then Call ScanA
Call Scan1 Call Belajar
If bolLajar = True Then
If CompFiles(RTrim(lblNmFile), RTrim(txtNmPic1)) Then If selisih < 30 Then
Pic99.Picture = Pic1.Picture txtNmPic99 = lblNmPic1
lblNama.Caption = lblNmPic1.Caption bolHasil = True
lblMirip = Format(TOtPers, "##.##") & " " & "%" Exit Do Else End If Else bolHasil = False rsCari.MoveNext End If Else
MsgBox "error neural network" Exit Do Unload Me End If End If Loop
If bolHasil = False Then
MsgBox "Tidak ada wajah yang cocok" Else End If End If prgss1.Visible = False End Sub
Private Function CompFiles(ByRef strCFFile1 As String, ByRef _ strCFFile2 As String) As Boolean
Open strCFFile1 For Binary As #1 Open strCFFile2 For Binary As #2 CompFiles = True
If LOF(1) >= LOF(2) Then selisih = LOF(1) - LOF(2)
Pers = (selisih / LOF(1)) * 100 Else
selisih = LOF(2) - LOF(1)
Pers = (selisih / LOF(2)) * 100 End If
TOtPers = 90 - Pers
lblMirip.Caption = Format(TOtPers, "##,##") & " " & "%" If selisih > 30 Then
lblMirip = "" Else Pic99.Picture = Pic1.Picture txtNmPic99 = lblNmPic1 CompFiles = True whole& = LOF(1) \ 10000 part& = LOF(1) Mod 10000 buffer1$ = String$(10000, 0) buffer2$ = String$(10000, 0) start& = 1
For X& = 1 To whole& Get #1, start&, buffer1$ Get #2, start&, buffer2$ If buffer1$ >= buffer2$ Then selisih = buffer1$ - buffer2$ Else
selisih = buffer2$ - buffer1$ End If If selisih > 30 Then CompFiles = False lblMirip = "" Exit For Else bolHasil = True End If start& = start& + 10000 Next buffer1$ = String$(part&, 0) buffer2$ = String$(part&, 0) Get #1, start&, buffer1$ Get #2, start&, buffer2$
If selisih > 50 Then CompFiles = False: lblMirip = "" End If Close End Function Sub Progress() prgss1.Visible = True prgss1.Min = 0 prgss1.Max = 10000 prgss1.Visible = True
For noPro = prgss1.Min To prgss1.Max prgss1.Value = noPro 'DoEvents Next noPro prgss1.Value = prgss1.Min prgss1.Visible = False End Sub Sub Scan1()
'If bolScan = True Then On Error Resume Next Q = 9
For YYY = 0 To Pic1.ScaleHeight - 1 Step Q For XXX = 0 To Pic1.ScaleWidth - 1 Step Q
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
55
Pic1.Line (XXX, YYY)-(XXX + Q, YYY + Q), Pixel, BF Next Pic1.Refresh Next Pic1.Refresh 'End If End Sub Sub ScanA()
'If bolScan = True Then On Error Resume Next Q = 9
For YYY = 0 To PicA.ScaleHeight - 1 Step Q For XXX = 0 To PicA.ScaleWidth - 1 Step Q
Pixel = GetPixel(PicA.HDC, XXX + 1, YYY + 1)
PicA.Line (XXX, YYY)-(XXX + Q, YYY + Q), Pixel, BF Next PicA.Refresh Next PicA.Refresh 'End If End Sub
Private Sub cmdLoad_Click() On Error Resume Next
With CommonDialog1
.DialogTitle = "Select image file ..."
.Filter = "Image Files (*.jpg, *.gif)|*.jpg;*.gif" .ShowOpen m_strImagePath = .FileName Image1.Picture = LoadPicture(.FileName) lblNmFile.Caption = LCase(.FileName) TxtNama.Text = LCase(.FileTitle) End With cmdLoad.Enabled = False cmdProsesGray.Enabled = True cmdProsesGray.SetFocus End Sub
Private Sub Form_Activate() bolLajar = False cmdLoad.Enabled = True cmdProsesGray.Enabled = False txtNmPic1.Locked = True txtNmPic99.Locked = True TxtNama = "" selisih = 0 noPro = 0 Pers = 0 TOtPers = 0 prgss1.Visible = False Image1.Picture = Nothing bolLajar = False TxtNama.Locked = True End Sub
Private Sub Form_Load()
h1(1, 1) = -1: h1(1, 2) = -2: h1(1, 3) = -1 h1(2, 1) = -3: h1(2, 2) = 15: h1(2, 3) = -2 h1(3, 1) = -1: h1(3, 2) = -3: h1(3, 3) = -1
For i = 1 To 3 For j = 1 To 3 h2(i, j) = h1(j, i) Next j Next i Dim Maindata$ Dim FF FF = FreeFile
Open App.Path & "\Data\Letter_Codes.txt" For Input As #FF Do While Not EOF(1)
Line Input #FF, Data Select Case Data
Case "START Letter-Codes": For X = 1 To 26
Line Input #FF, Maindata PrintCode(X) = Maindata Next X
End Select Loop
Close #FF
Call CreateNet(1.5, Array(25, 26)) '25 Input Neurons (5x5-Picture) _ , 26 Output-Neurons for every possible Letter
On Error Resume Next
Set DataBaseConection = New ADODB.Connection
With DataBaseConection
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; _ Data Source=" & App.Path & "\mypic.mdb"
.CursorLocation = adUseClient .Open
End With
Set CN = New ADODB.Connection
CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; _ Data Source=" & App.Path & "\mypic.mdb"
CN.CursorLocation = adUseClient CN.Open
Set DataBaseRecorset = New ADODB.Recordset
DataBaseRecorset.Open "Data", DataBaseConection, adOpenStatic, _ adLockPessimistic, adCmdTable
End Sub
Private Sub Form_Unload(Cancel As Integer) EraseNetwork
End Sub
Private Sub TxtNama_Change() If Len(TxtNama) < 1 Then
cmdProsesGray.Enabled = False Exit Sub
Else
cmdProsesGray.Enabled = True
Pic.Picture = LoadPicture(App.Path & "\Gambar\" & TxtNama) PicA.Picture = LoadPicture(App.Path & "\Gambar\" & TxtNama)
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
57
End Sub
Private Sub txtNmPic1_Change() txtNmPic1 = LCase(txtNmPic1) End Sub
4.DataWajah
Dim CN As ADODB.Connection Dim rsCariRec As Recordset Dim rsData As Recordset Dim rsCari As Recordset Dim rsDataPic As Recordset Dim tambah As Boolean Dim Cari As Boolean
Dim m_strImagePath As String Dim rsCariNmFile As Recordset Dim NmFile As String
Dim bolAdaNm As Boolean Dim jumRec As Integer Dim NamaFile As String Private Sub cmdAdd_Click() tambah = True
Cari = False TxtNama.Text = ""
Label1.Caption = "Jumlah Data " lblNmFile.Caption = "" Pic.Picture = Nothing cmdAdd.Visible = False cmdSave.Visible = True cmdSave.Enabled = False cmdDelete.Enabled = False TxtNama.Enabled = True cmdCari.Enabled = False TxtNama.SetFocus End Sub
Private Sub cmdBatal_Click() TxtNama.Text = "" TxtNama.Enabled = False lblNmFile = "" NamaFile = "" jumRec = 0 cmdMundurPic1.Enabled = False cmdMajuPic1.Enabled = False Pic.Picture = Nothing cmdAdd.Visible = True cmdSave.Visible = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdCari.Enabled = True cmdAdd.SetFocus End Sub
Private Sub cmdcari_Click() Cari = True
tambah = False
cmdCari.Enabled = False cmdAdd.Enabled = False cmdCari.Enabled = False
TxtNama.Text = "" lblNmFile.Caption = "" TxtNama.Enabled = True Pic.Picture = Nothing 'Image1.Picture = Nothing TxtNama.SetFocus End Sub
Private Sub cmdDelete_Click() On Error Resume Next
cmdDelete.Enabled = False rsCari.Delete
rsDataPic.Delete
MsgBox "Data sudah di hapus" cmdAdd.Visible = True cmdSave.Visible = False TxtNama = "" lblNmFile.Caption = "" Cari = False tambah = False Pic.Picture = Nothing Image1.Picture = Nothing jumRec = 0 Hitung cmdAdd.Enabled = True cmdCari.Enabled = True cmdAdd.SetFocus End Sub
Private Sub cmdExit_Click() Unload Me
End Sub
Private Sub cmdLoad_Click() With CommonDialog1
.DialogTitle = "Select image file ..."
.Filter = "Image Files (*.jpg, *.gif)|*.jpg;*.gif" .ShowOpen m_strImagePath = .FileName Pic.Picture = LoadPicture(.FileName) lblNmFile.Caption = .FileTitle NamaFile = .FileName End With cmdSave.Enabled = True End Sub
Private Sub cmdMajuPic1_Click() On Error Resume Next
If Not rsDataPic.EOF Then rsDataPic.MoveNext
cmdDelete.Enabled = True
Set TxtNama.DataSource = rsDataPic Set Pic.DataSource = rsDataPic Pic.DataField = "myImage" TxtNama.DataField = "Nama" Label1.Caption = "Record ke "
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
59
lblJum.Caption = jumRec rsDataPic.MovePrevious End If Else Pic.Picture = LoadPicture() End If End SubPrivate Sub cmdMundurPic1_Click() On Error Resume Next
If Not rsDataPic.BOF Then rsDataPic.MovePrevious cmdDelete.Enabled = True
Set TxtNama.DataSource = rsDataPic Set Pic.DataSource = rsDataPic Pic.DataField = "myImage" TxtNama.DataField = "Nama" Label1.Caption = "Record ke "
lblJum.Caption = lblJum - 1 'jumRec If rsDataPic.BOF Then lblJum.Caption = 1 rsDataPic.MoveNext End If Else Pic.Picture = LoadPicture() End If End Sub
Private Sub cmdPilih_Click()
Set rsDataPic = New ADODB.Recordset adCmdTable
rsDataPic.Open "Select * from Data order by nama asc", CN, 1, 2 If Not rsDataPic.EOF = True Then
Set TxtNama.DataSource = rsDataPic Set Pic.DataSource = rsDataPic Pic.DataField = "myImage" TxtNama.DataField = "Nama" cmdMundurPic1.Enabled = True cmdMajuPic1.Enabled = True Label1.Caption = "Record ke " lblJum.Caption = 1 End If End Sub
Private Sub cmdSave_Click() On Error Resume Next
Dim intNum As Integer Dim bytBLOB() As Byte With rsData
.AddNew
If (m_strImagePath <> "") Then ' Buka file image
intNum = FreeFile
Open m_strImagePath For Binary As #intNum ReDim bytBLOB(FileLen(m_strImagePath)) ' Baca & isi ke database
Get #intNum, , bytBLOB Close #1
End If !Nama = TxtNama.Text !NmFile = lblNmFile.Caption !NamaFile = NamaFile .Update End With
MsgBox "Data sudah disimpan" TxtNama.Text = "" lblNmFile.Caption = "" jumRec = 0 Hitung Pic.Picture = Nothing cmdSave.Visible = False tambah = False cmdAdd.Visible = True cmdCari.Enabled = True cmdAdd.Visible = True cmdLoad.Enabled = False cmdAdd.Enabled = True cmdAdd.SetFocus End Sub
Private Sub Form_Activate() cmdLoad.Enabled = False cmdSave.Visible = False cmdAdd.Visible = True cmdAdd.Enabled = True cmdDelete.Enabled = False cmdCari.Enabled = True cmdMundurPic1.Enabled = False cmdMajuPic1.Enabled = False TxtNama.Text = "" lblNmFile.Caption = "" Pic.Picture = Nothing jumRec = 0 Hitung TxtNama.Enabled = False cmdLoad.Enabled = False cmdAdd.SetFocus End Sub
Private Sub Form_Load()
Set CN = New ADODB.Connection
CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; _ Data Source=" & App.Path & "\mypic.mdb"
CN.CursorLocation = adUseClient CN.Open
Set rsData = New ADODB.Recordset
rsData.Open "Data", CN, adOpenStatic, adLockPessimistic, adCmdTable adCmdTable
End Sub Sub Hitung()
Set rsCariRec = New ADODB.Recordset
rsCariRec.Open "Select * from Data", CN, 1, 2 If Not rsCariRec.EOF = True Then
Do While Not rsCariRec.EOF = True jumRec = jumRec + 1
rsCariRec.MoveNext
If rsCariRec.EOF = True Then Exit Do
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
61
Loop
Label1.Caption = "Jumlah Data " lblJum.Caption = jumRec
End If End Sub
Private Sub TxtNama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
Set rsCari = New ADODB.Recordset
rsCari.Open "select * from Data where Nama='" & TxtNama.Text & _ "'", CN, 1, 2
If tambah = True Then
If rsCari.EOF = True Then bolAdaNm = False
cmdLoad.Enabled = True cmdLoad.SetFocus
Else
MsgBox "Nama Sudah ada" cmdLoad.Enabled = False TxtNama.Text = ""
Pic.Picture = Nothing TxtNama.SetFocus End If
ElseIf Cari = True Then
Set rsCari = New ADODB.Recordset
rsCari.Open "select * from Data where nama='" & _ TxtNama.Text & "'", CN, 1, 2
If Not rsCari.EOF = True Then
Set TxtNama.DataSource = rsCari Set Image1.DataSource = rsCari Set lblNmFile.DataSource = rsCari Image1.DataField = "myImage" Pic.Picture = Image1.Picture lblNmFile.DataField = "nmFile" cmdDelete.Enabled = True
Else
MsgBox "Image tidak ada"
Image1.Picture = LoadPicture() End If End If End If End Sub 5.Image
Public mProgress As Long Public StrSize As String Public StrPercent As String Public StrVal As String
Private Sub mniBrightnessScaling_Click() On Error GoTo ErrHandler
StatusBar1.SimpleText = "Change brightness using Linear Scaling" _ StrVal = ""
StrVal = InputBox("Input addition ( 1 - 10 )", "Linear Scaling") If StrVal <> "" Then
If isNumber(StrVal) And StrVal <= 10 Then
Call BitBlt(Me.HDC, 0, 0, Picture1.ScaleWidth, _ Picture1.ScaleHeight, Picture1.HDC, 0, 0, SRCCOPY) Me.Refresh
Else
MsgBox "Please put proper value" End If
End If Exit Sub ErrHandler:
MsgBox "Please put proper value" End Sub
Private Sub MnuAbout_Click() frmAbout.Visible = True End Sub
Private Sub mnuBrightnessAddition_Click() On Error GoTo ErrHandler
StatusBar1.SimpleText = "Change brightness using Linear Addition" StrVal = ""
StrVal = InputBox("Input addition ( 1 - 255 )", "Linear Addition") If StrVal <> "" Then
If isNumber(StrVal) And StrVal <= 255 Then
Call FilterG(iBRIGHTNESSADD, Picture1.Image, 0) Call BitBlt(Me.HDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.HDC, 0, 0, SRCCOPY) Me.Refresh
Else
MsgBox "Please put proper value" End If
End If Exit Sub ErrHandler:
MsgBox "Please put proper value" End Sub
Private Sub mnuBrightnessMul_Click() On Error GoTo ErrHandler
StatusBar1.SimpleText = "Change brightness using Linear _ Multiplication"
StrVal = 1
Call FilterG(iBRIGHTNESSMUL, Picture1.Image, 0)
Call BitBlt(Me.HDC, 0, 0, Picture1.ScaleWidth, Picture1. _ ScaleHeight, Picture1.HDC, 0, 0, SRCCOPY)
Me.Refresh Exit Sub ErrHandler:
MsgBox "Please put proper value" End Sub
Private Sub MnuExit_Click() Unload Me
End Sub
Private Sub MnuGreyScale_Click(Index As Integer)
Lestya Dila Rahma : Pengenalan Wajah Berdasarkan Pengolahan Citra Digital Dengan Metode Gabor Wavelet, 2010.
63
Call BitBlt(Me.HDC, 0, 0, Picture1.ScaleWidth, Picture1. _ ScaleHeight, Picture1.HDC, 0, 0, SRCCOPY)
Me.Refresh End Sub
Private Sub MnuInvert_Click()
StatusBar1.SimpleText = "Invert the image" Call FilterG(iINVERT, Picture1.Image, 0)
Call BitBlt(Me.HDC, 0, 0, Picture1.ScaleWidth, Picture1. _ ScaleHeight, Picture1.HDC, 0, 0, SRCCOPY)
Me.Refresh End Sub
Private Sub mnuNoiseBoth_Click() On Error GoTo ErrHandler
StatusBar1.SimpleText = "Salt Noise" StrPerent = ""
StrPercent = InputBox("Input percent of noise", "Salt Noise") If StrPercent <> "" Then
If isNumber(StrPercent) And StrPercent <= 100 Then Call FilterG(iNOISEBOTH, Picture1.Image, 0) Call BitBlt(Me.HDC, 0, 0, Picture1.ScaleWidth, _ Picture1.ScaleHeight, Picture1.HDC, 0, 0, SRCCOPY) Me.Refresh
Else
MsgBox "Please put proper value" End If
End If Exit Sub ErrHandler:
MsgBox "Please put proper value" End Sub
Private Sub mnuNoisePepper_Click() On Error GoTo ErrHandler
StatusBar1.SimpleText = "Salt Noise" StrPercent = ""
StrPercent = InputBox("Input percent of noise", "Salt Noise") If StrPercent <> "" Then
If isNumber(StrPercent) And StrPercent <= 100 Then