Created
July 1, 2018 18:12
-
-
Save jirawatee/4ec75614aab20c7a9648926b15ebd661 to your computer and use it in GitHub Desktop.
FaceDectorOnDeviceExtract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (FirebaseVisionFace face : faces) { | |
Rect bounds = face.getBoundingBox(); | |
float rotY = face.getHeadEulerAngleY(); // Head is rotated to the right rotY degrees | |
float rotZ = face.getHeadEulerAngleZ(); // Head is tilted sideways rotZ degrees | |
// If landmark detection was enabled (mouth, ears, eyes, cheeks, and | |
// nose available): | |
FirebaseVisionFaceLandmark leftEar = face.getLandmark(FirebaseVisionFaceLandmark.LEFT_EAR); | |
if (leftEar != null) { | |
FirebaseVisionPoint leftEarPos = leftEar.getPosition(); | |
} | |
// If classification was enabled: | |
if (face.getSmilingProbability() != FirebaseVisionFace.UNCOMPUTED_PROBABILITY) { | |
float smileProb = face.getSmilingProbability(); | |
} | |
if (face.getRightEyeOpenProbability() != FirebaseVisionFace.UNCOMPUTED_PROBABILITY) { | |
float rightEyeOpenProb = face.getRightEyeOpenProbability(); | |
} | |
// If face tracking was enabled: | |
if (face.getTrackingId() != FirebaseVisionFace.INVALID_ID) { | |
int id = face.getTrackingId(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment