Face106Interface
APJS Script API reference for the Face106Interface interface.
| Type | Name | Interface Description |
|---|---|---|
| Variables | eyeDistance: number | • Function: Eye distance |
| Variables | ID: number | • Function: Each detected face has a unique faceID. When a face that was lost during tracking is detected again, it will have a new faceID. |
| Variables | pitch: number | • Function: Pitch angle in radians. Positive and negative values represent opposite up/down head tilts. |
| Variables | pointsArray: Float32Array | • Function: Vector2f Flat Array <br/>Array of 106 key points of the human face, stored as [x0, y0, x1, y1, ...] in normalized camera input coordinates [0.0, 1.0]. (0, 0) is bottom-left; x increases rightward and y increases upward. |
| Variables | rect: Rect | • Function: Bounding rectangle of the detected face in normalized coordinates [0.0, 1.0], relative to the camera input image. |
| Variables | roll: number | • Function: Roll angle in radians. Positive and negative values represent opposite head tilts around the forward axis. |
| Variables | score: number | • Function: Confidence score in the range [0, 1]. |
| Variables | visibilityArray: Float32Array | • Function: Visibility of corresponding points. The point is not occluded: 1.0, and occluded: 0.0 |
| Variables | yaw: number | • Function: Yaw angle in radians. Positive and negative values represent opposite side-to-side head rotations. |
| Functions | hasAction(action: number | FaceAction): boolean | • Function: Returns whether the specified facial action is currently detected. Parameters • |
Examples
pitch: number
const face = result.getFaceBaseInfo(0);
const upWard = face.pitch < -0.2;
const downWard = face.pitch > 0.2;
roll: number
const face = result.getFaceBaseInfo(0);
const isTiltedLeft = face.roll > 0.2;
const isTiltedRight = face.roll < -0.2;
yaw: number
const face = result.getFaceBaseInfo(0);
const facingLeft = face.yaw > 0.2;
const facingRight = face.yaw < -0.2;
hasAction(action: number | FaceAction): boolean
const face = result.getFaceBaseInfo(0);
if (face.hasAction(APJS.FaceAction.MouthAh)) {
// react to an open mouth
}
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use Face106Interface here
}
onUpdate(deltaTime: number) {
}
}