(4) Kinect face recognition

kinect can not only obtain the rotation information of the face position by perturbing the camera, but also obtain the three-dimensional coordinates of the face contour.

You can refer to the scene KinectFaceTrackingDemo1-4 in the plugin. The script FacetrackingManager is required on the basis of kinectManager.

1) Obtain the running instance of Kinect through KinectManager kinectManager = KinectManager.Instance;

2) Get sensor information through sensorData = kinectManager.GetSensorData();

3) Obtain relevant information with the sensorInterface of the SensorData class. The following are some methods, which can obtain the Rect of the face and the position of the head, etc.

 

    bool IsFaceTrackingAvailable(ref bool bNeedRestart);

    // initializes libraries and resources needed by the face tracking subsystem
    bool InitFaceTracking(bool bUseFaceModel, bool bDrawFaceRect);

    // releases the resources and libraries used by the face tracking subsystem
    void FinishFaceTracking();

    // this method gets invoked periodically to update the face tracking state
    // returns true if update is successful, false otherwise
    bool UpdateFaceTracking();

    // returns true if face tracking is initialized, false otherwise
    bool IsFaceTrackingActive();

    // returns true if face rectangle(s) must be drawn in color map, false otherwise
    bool IsDrawFaceRect();

    // returns true if the face of the specified user is being tracked at the moment, false otherwise
    bool IsFaceTracked(long userId);

    // gets the face rectangle in color coordinates. returns true on success, false otherwise
    bool GetFaceRect(long userId, ref Rect faceRect);

    // visualizes face tracker debug information
    void VisualizeFaceTrackerOnColorTex(Texture2D texColor);

    // gets the head position of the specified user. returns true on success, false otherwise
    bool GetHeadPosition(long userId, ref Vector3 headPos);
    
    // gets the head rotation of the specified user. returns true on success, false otherwise
    bool GetHeadRotation(long userId, ref Quaternion headRot);

 

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325209029&siteId=291194637