Face Wish

Analyzes face wish in a video stream. The event listener keeps getting the data in a JSON object as FaceAI keeps analyzing the face wish.

Methods

  • EnxFaceAI.startFaceWish(config, callback) : To start analyzing face wish in a video stream.
  • EnxFaceAI.stopFaceWish(callback) : To stop analyzing face wish in a video stream.

Parameters

For Method: EnxFaceAI.startFaceWish(config, callback)

  • config : JSON Object. This is to configure or customize parameter using which the Face Wish would be analyzed.
    • smoothness : Number. Default 0.80. Range 0-1. Value closer to 1 provides greater smoothing and slower response time. Lower values provide lesser smoothing but faster response time.
  • callback : Callback to know that processing request has been accepted.

For Method: EnxFaceAI.stopFaceWish(callback)

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

Event Listener

  • face-wish: This event notification is received repeatedly with the Face Wish Analysis report as a JSON object.

JSON Object: Received with Face Wish Analysis data.

{ output: {
wish: Number
}
}

Analysis Data Explanation

  • output: Face Wish Report
    • wish: Filtered value (smoothened) in range [0, 1.0]. A value closer to 0 represents a lower wish, a value closer to 1.0 represents a higher wish.

Sample Code

config = {
smoothness: 0.80
};
// Start Face Wish
faceAI.startFaceWish(config, (res) => {
if (res.result === 0) {
window.addEventListener("face-wish", (evt) => {
console.log(evt.detail, "face-wish");
});
}
});
// Stop Face Wish
faceAI.stopFaceWish((res) => {
if (res.result === 0) { }
});