?? frmmain.frm
字號:
VERSION 5.00
Begin VB.Form frmMain
BackColor = &H00000000&
Caption = "Face Recognition Demonstration"
ClientHeight = 3825
ClientLeft = 60
ClientTop = 345
ClientWidth = 4800
ForeColor = &H00FFFFFF&
LinkTopic = "Form1"
ScaleHeight = 3825
ScaleWidth = 4800
StartUpPosition = 3 'Windows Default
Begin VB.PictureBox pic
Height = 1215
Index = 1
Left = 3240
Picture = "frmMain.frx":0000
ScaleHeight = 111.594
ScaleMode = 0 'User
ScaleWidth = 126.23
TabIndex = 4
Top = 1920
Visible = 0 'False
Width = 1215
End
Begin VB.CommandButton cmdTest
Caption = "Test"
Enabled = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 3
Top = 840
Width = 2295
End
Begin VB.PictureBox pic
Height = 1215
Index = 0
Left = 3240
Picture = "frmMain.frx":0925
ScaleHeight = 111.594
ScaleMode = 0 'User
ScaleWidth = 126.23
TabIndex = 1
Top = 120
Width = 1215
End
Begin VB.CommandButton cmdStart
Caption = "Begin Training"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 0
Top = 240
Width = 2295
End
Begin VB.Label lblIdentity
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Identified"
ForeColor = &H00FFC0C0&
Height = 255
Left = 3360
TabIndex = 5
Top = 3240
Visible = 0 'False
Width = 975
End
Begin VB.Image Image1
Height = 2100
Left = 120
Picture = "frmMain.frx":124A
Stretch = -1 'True
Top = 1560
Width = 2220
End
Begin VB.Shape shaCurrent
FillStyle = 0 'Solid
Height = 135
Index = 4
Left = 8160
Shape = 3 'Circle
Top = 4080
Visible = 0 'False
Width = 135
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Input Image"
ForeColor = &H00FFC0C0&
Height = 255
Left = 3360
TabIndex = 2
Top = 1440
Width = 975
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim faces As New ClassFaceRecogniser
Const image_Width = 25
Const image_Height = 25
Private Sub cmdStart_Click()
Call init
cmdStart.Caption = "Training Complete"
cmdStart.Enabled = False
cmdTest.Enabled = True
End Sub
Private Sub loadFace(index As Integer, instance As Integer, picbox As PictureBox)
On Error GoTo loadImages_err
Dim filename As String
filename = App.Path & "\face" & Trim(CStr(index)) & Chr(instance + 97) & ".jpg"
If (Dir$(filename) <> "") Then
picbox.Picture = LoadPicture(filename)
End If
loadImages_exit:
Exit Sub
loadImages_err:
MsgBox "frmMain/loadFace/" & Error$(Err)
Resume loadImages_exit
End Sub
Private Sub init()
Dim i As Integer
Dim j As Integer
Call faces.init(image_Width, image_Height)
For j = 0 To 1
For i = 0 To 19
Call loadFace(i, j, pic(0))
Call faces.addFace(pic(0), Trim(Str(i)))
Next
Next
End Sub
Private Sub cmdTest_Click()
Static i As Integer
Dim closestImage As Integer
lblIdentity.Visible = True
pic(1).Visible = True
Call loadFace(i, 2, pic(0))
closestImage = Val(faces.Identify(pic(0)))
Call loadFace(closestImage, 0, pic(1))
i = i + 1
If (i > 19) Then
i = 0
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -