Face Pose

Analyzes face rotation and position of a face in a video stream. The event listener continuously gets the data in a JSON object as FaceAI detects face rotation in a video stream. The data of the face rotation angle is represented in terms of radiants as Pitch, Roll, and Yaw.

Methods

  • EnxFaceAI.startFacePose(config, callback) : To start analyzing face rotation and position in a video stream.|

  • EnxFaceAI.stopFacePose(callback) : To stop analyzing face rotation and position in a video stream.|

Parameters

For Method: EnxFaceAI.startFacePose(config, callback)

  • config: Number. To configure or customize parameter using which the Face Pose would be analyzed.
    • smoothness: Default 0.65. Range 0-1. A value closer to 1 provides greater smoothing and slower response time. Lower values provide less smoothing but faster response time. Set it to 0 (zero) if you need the raw signal.
  • callback: JSON Object. Callback to know that processing request has been accepted.

For Method: EnxFaceAI.stopFacePose(callback)

  • callback: Callback to know that processing request has been accepted.

Event Listener

  • face-pose: JSON Object. This event notification is received repeatedly with the Face Rotation & Position Analysis report as a JSON object.

JSON Object: Received with Face Rotation & Position Analysis data.

{ output: {
pose: {
pitch: Number,
roll: Number,
yaw: Number
}
}
}

Analysis Data Explanation

  • output : Face Rotation & Position Report
    • pose : Filtered (smoothened) pose rotation angles expressed in radiants as pitch, roll and yaw.

Face Pose

Note: The maximum and minimum ranges for rotation angles are currently limited to +- (Pi/2) in radians, corresponding to +- (90°) in degrees, for each of the 3 axes. The zero point is when a face looks straight at the camera.

Sample Code

config = {
smoothness: 0.65
};
// Start Face Pose
faceAI.startFacePose(config, (res) => {
if (res.result === 0) {
window.addEventListener("face-pose", (evt) => {
console.log(evt.detail, "face-pose");
});
}
});
// Stop Face Pose
faceAI.stopFacePose((res) => {
if (res.result === 0) { }
});