Class FaceLandmarks

java.lang.Object
com.codename1.ai.vision.FaceLandmarks

public final class FaceLandmarks extends Object

The keys Face.getLandmarks() uses, as constants instead of literals. Every backend normalizes its own landmark identifiers onto these names; a landmark the backend could not locate is absent from the map rather than present with a meaningless position, so read one through Face.getLandmark(String) and check for null.

detector.process(VisionImage.fromCameraFrame(frame)).ready(faces -> {
    for (Face face : faces) {
        VisionPoint left = face.getLandmark(FaceLandmarks.LEFT_EYE);
        VisionPoint right = face.getLandmark(FaceLandmarks.RIGHT_EYE);
        if (left != null && right != null) {
            placeGlasses(left.toPoint(preview), right.toPoint(preview));
        }
    }
});