Emgu.CV 人脸锁定


Imports Emgu.CV
Imports Emgu.CV.Structure
Imports Emgu.Util
Imports System.Windows.Forms
Imports System.Drawing


Module Module1

    Sub Main()
        'Load the image from file
        Dim img As New Image(Of Bgr, Byte)("C:\Users\zxl\Desktop\2.jpg")

        'Load the object detector
        Dim objectToDetect As New HaarCascade("C:\Users\zxl\Downloads\haarcascade_frontalface_alt2.xml")

        'Convert the image to Grayscale
        Dim imgGray As Image(Of Gray, Byte) = img.Convert(Of Gray, Byte)()

        For Each face As MCvAvgComp In imgGray.DetectHaarCascade(objectToDetect)(0)
            img.Draw(face.rect, New Bgr(Color.White), 1)
        Next

        'Show the image
        UI.ImageViewer.Show(img)

    End Sub

End Module

haarcascade_frontalface_alt2.xml

Emgu.CV







你可能感兴趣的:(Emgu.CV 人脸锁定)