Banuba SDK Web AR Advanced tutorials
Retrieving FRX landmarks
It is possible to retrieve face landmarks from the face recognition performed by SDK:
player.addEventListener(Player.FRAME_DATA_EVENT, ({ detail: frameData }) => {
const hasFace = frameData.get("frxRecognitionResult.faces.0.hasFace")
if (!hasFace) return console.log("Face not found")
const landmarks = frameData.get("frxRecognitionResult.faces.0.landmarks")
console.log("Landmarks:", landmarks)
})
The landmarks array stores flattened pairs of 68 points in form of [x1, y1, x2, y2, ... , x68, y68]
:
note
Pay attention that an effect with Face Recognition (e.g. DebugWireframe) must be applied to the player so frxRecognitionResult is available on FrameData.
See the FRAME_DATA_EVENT and FrameData docs for more details and examples.