CHƯƠNG 3 THIẾT KẾ VÀ XÂY DỰNG CHƯƠNG TRÌNH
6. Phát hiện khuôn mặt
Private Function Tim_Cac_Khuon_Mat(MH As Integer, MW As Integer) As Integer
Dim i As Integer, j As Integer Dim SUV As Integer
Dim SDT As Integer, BD As Integer Dim Thoat As Boolean
SUV = Tim_Cac_Ung_Vien(MH, MW) If SUV = 0 Then
Tim_Cac_Khuon_Mat = 0 Exit Function
End If
If SUV = 1 Then SDT = 2
ReDim DS_DT(1)
DS_DT(1).X1 = DT_UV(1).X1 DS_DT(1).X2 = DT_UV(1).X2 DS_DT(1).Y1 = DT_UV(1).Y1 DS_DT(1).Y2 = DT_UV(1).Y2 Else
For i = 1 To SUV
If (DT_UV(i).X2 - DT_UV(i).X1 < 6) Or (DT_UV(i).Y2 - DT_UV(i).Y1 < 8) Then DT_UV(i).TT = False
Next i SDT = 1
For i = 1 To SUV
If DT_UV(i).TT Then
TIEU LUAN MOI download : skknchat@gmail.com
(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu
BD = i Exit For End If Next i Do
ReDim Preserve DS_DT(SDT) DS_DT(SDT).X1 = DT_UV(BD).X1 DS_DT(SDT).X2 = DT_UV(BD).X2 DS_DT(SDT).Y1 = DT_UV(BD).Y1 DS_DT(SDT).Y2 = DT_UV(BD).Y2 DT_UV(BD).TT = False
For j = SDT + 1 To SUV If DT_UV(j).TT Then
If DS_DT(SDT).X2 < (DT_UV(j).X1 - 4) Then DT_UV(j).TT = True
Else
If ((DT_UV(j).Y1 - DS_DT(SDT).Y2 < 5) Or (DS_DT(SDT).Y2 >= DT_UV(j).Y1)) Then
If DS_DT(SDT).X1 > DT_UV(j).X1 Then DS_DT(SDT).X1 = DT_UV(j).X1
If DS_DT(SDT).X2 < DT_UV(j).X2 Then DS_DT(SDT).X2 = DT_UV(j).X2
If DS_DT(SDT).Y2 < DT_UV(j).Y2 Then DS_DT(SDT).Y2 = DT_UV(j).Y2
DT_UV(j).TT = False End If
End If End If Next j
SDT = SDT + 1 For i = 1 To SUV
If DT_UV(i).TT Then BD = i
Exit For End If Next i
Thoat = False For i = 1 To SUV
(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu
Thoat = Thoat Or DT_UV(i).TT Next i
If Not Thoat Then Exit Do Loop
End If
Tim_Cac_Khuon_Mat = SDT - 1 End Function
Public Function Chac_Chan_Khuon_Mat(MH As Integer, MW As Integer) As Integer
Dim i As Integer, SN As Integer Dim CN As Integer
CN = Tim_Cac_Khuon_Mat(MH, MW) If CN = 0 Then
Chac_Chan_Khuon_Mat = 0 Exit Function
End If SN = 0
For i = 1 To CN
If ((DS_DT(i).Y2 - DS_DT(i).Y1) >= 8) And ((DS_DT(i).X2 - DS_DT(i).X1) >= 6) Then
SN = SN + 1
ReDim Preserve Con_Nguoi(SN)
If (DS_DT(i).X2 - DS_DT(i).X1) Mod 2 = 0 Then Con_Nguoi(SN).X1 = DS_DT(i).X1
Con_Nguoi(SN).X2 = DS_DT(i).X2 Else
Con_Nguoi(SN).X1 = DS_DT(i).X1 Con_Nguoi(SN).X2 = DS_DT(i).X2 + 1 End If
If (DS_DT(i).Y2 - DS_DT(i).Y1) Mod 2 = 0 Then Con_Nguoi(SN).Y1 = DS_DT(i).Y1
Con_Nguoi(SN).Y2 = DS_DT(i).Y2 Else
Con_Nguoi(SN).Y1 = DS_DT(i).Y1 Con_Nguoi(SN).Y2 = DS_DT(i).Y2 + 1 End If
TIEU LUAN MOI download : skknchat@gmail.com
(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu
Con_Nguoi(SN).H = (Con_Nguoi(SN).Y2 - Con_Nguoi(SN).Y1) * 5
Con_Nguoi(SN).W = (Con_Nguoi(SN).X2 - Con_Nguoi(SN).X1) * 5
ReDim Con_Nguoi(SN).Pic(Con_Nguoi(SN).H - 1, Con_Nguoi(SN).W - 1)
Call Cat_Anh(Con_Nguoi(SN), MH, MW) Call So_Thuc_Hoa(Con_Nguoi(SN)) End If
Next i
Chac_Chan_Khuon_Mat = SN End Function
Private Sub So_Thuc_Hoa(KM As IsHuman) Dim i As Integer, j As Integer
Dim DW As Integer, DH As Integer Dim Kt As Integer, t As Single Dim Ki As Integer, Kj As Integer Dim Mi As Integer, Mj As Integer DW = KM.W \ 10: DH = KM.H \ 10 Kt = -9
For i = 0 To 9 Kt = Kt + 9 For j = 0 To 9 t = 0
For Ki = 0 To DH - 1 Mi = i * DH + Ki For Kj = 0 To DW - 1 Mj = j * DW + Kj t = t + KM.Pic(Mi, Mj) Next Kj
Next Ki t = t / DW t = t / DH t = t / 255
KM.STH(Kt + j) = t Next j
Next i End Sub
(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu(LUAN.van.THAC.si).nghien.cuu.mot.so.phuong.phap.nhan.dang.doi.tuong.ung.dung.trong.he.thong.camera.quan.sat.bao.ve.muc.tieu