Face Attention
Analyzes the face attention in a video stream. The event listener continuously gets the data in a JSON object as FaceAI analyzes the face attention.
Method
To analyze face attention in a video stream.
Method: EnxFaceAI.startFaceAttention(callback)
Parameter
callback
: Callback to know that processing request has been accepted.
Event Listener
face-attention
: This event notification is received repeatedly with the Face Attention Analysis report as a JSON object.
JSON Object: Received with Face Attention Analysis data.
{ output: {attention: Number}}
Analysis Data Explanation
output
: Face Attention Reportattention
: Filtered value (smoothened) in range [0.0, 1.0]. A value close to 1.0 represents attention, a value close to 0.0 represents distraction
Sample Code
// Start Face AttentionfaceAI.startFaceAttention((res) => {if (res.result === 0) {window.addEventListener("face-attention", (evt) => {console.log(evt.detail, "face-attention");});}});