public final class FaceLandmarks

  1. Object
  2. FaceLandmarks

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));
        }
    }
});

Fields

public static final String LEFT_EYE = "leftEye"Center of the subject’s left eye, which appears on the right of the image.
public static final String RIGHT_EYE = "rightEye"Center of the subject’s right eye, which appears on the left of the image.
public static final String NOSE_BASE = "noseBase"Base of the nose, between the nostrils.
public static final String MOUTH_LEFT = "mouthLeft"Left corner of the mouth.
public static final String MOUTH_RIGHT = "mouthRight"Right corner of the mouth.

Inherited methods

Field details

LEFT_EYE

public static final String LEFT_EYE = "leftEye"
Center of the subject’s left eye, which appears on the right of the image.

RIGHT_EYE

public static final String RIGHT_EYE = "rightEye"
Center of the subject’s right eye, which appears on the left of the image.

NOSE_BASE

public static final String NOSE_BASE = "noseBase"
Base of the nose, between the nostrils.

MOUTH_LEFT

public static final String MOUTH_LEFT = "mouthLeft"
Left corner of the mouth.

MOUTH_RIGHT

public static final String MOUTH_RIGHT = "mouthRight"
Right corner of the mouth.