Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 5683919

Browse files
committed
Added faceEulerAngle to MLKitDetectFacesResultFace
1 parent 4ac147c commit 5683919

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/mlkit/facedetection/index.android.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export class MLKitFaceDetection extends MLKitFaceDetectionBase {
3737
smilingProbability: face.getSmilingProbability() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.UNCOMPUTED_PROBABILITY ? face.getSmilingProbability() : undefined,
3838
leftEyeOpenProbability: face.getLeftEyeOpenProbability() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.UNCOMPUTED_PROBABILITY ? face.getLeftEyeOpenProbability() : undefined,
3939
rightEyeOpenProbability: face.getRightEyeOpenProbability() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.UNCOMPUTED_PROBABILITY ? face.getRightEyeOpenProbability() : undefined,
40-
trackingId: face.getTrackingId() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.INVALID_ID ? face.getTrackingId() : undefined
40+
trackingId: face.getTrackingId() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.INVALID_ID ? face.getTrackingId() : undefined,
41+
headEulerAngleY: face.getHeadEulerAngleY(),
42+
headEulerAngleZ: face.getHeadEulerAngleZ()
4143
});
4244
}
4345

@@ -98,7 +100,9 @@ export function detectFacesOnDevice(options: MLKitDetectFacesOnDeviceOptions): P
98100
smilingProbability: face.getSmilingProbability() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.UNCOMPUTED_PROBABILITY ? face.getSmilingProbability() : undefined,
99101
leftEyeOpenProbability: face.getLeftEyeOpenProbability() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.UNCOMPUTED_PROBABILITY ? face.getLeftEyeOpenProbability() : undefined,
100102
rightEyeOpenProbability: face.getRightEyeOpenProbability() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.UNCOMPUTED_PROBABILITY ? face.getRightEyeOpenProbability() : undefined,
101-
trackingId: face.getTrackingId() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.INVALID_ID ? face.getTrackingId() : undefined
103+
trackingId: face.getTrackingId() !== com.google.firebase.ml.vision.face.FirebaseVisionFace.INVALID_ID ? face.getTrackingId() : undefined,
104+
headEulerAngleY: face.getHeadEulerAngleY(),
105+
headEulerAngleZ: face.getHeadEulerAngleZ()
102106
});
103107
}
104108
}

src/mlkit/facedetection/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export interface MLKitDetectFacesResultFace {
2020
ios?: any;
2121
android?: any;
2222
bounds?: MLKitDetectFacesResultBounds;
23+
headEulerAngleZ?: number;
24+
headEulerAngleY?: number;
2325
}
2426

2527
export interface MLKitDetectFacesOnDeviceResult extends MLKitResult {

src/mlkit/facedetection/index.ios.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export class MLKitFaceDetection extends MLKitFaceDetectionBase {
3232
leftEyeOpenProbability: face.hasLeftEyeOpenProbability ? face.leftEyeOpenProbability : undefined,
3333
rightEyeOpenProbability: face.hasRightEyeOpenProbability ? face.rightEyeOpenProbability : undefined,
3434
trackingId: face.hasTrackingID ? face.trackingID : undefined,
35-
bounds: face.frame
35+
bounds: face.frame,
36+
headEulerAngleY: face.headEulerAngleY,
37+
headEulerAngleZ: face.headEulerAngleZ
3638
});
3739
}
3840

@@ -91,7 +93,9 @@ export function detectFacesOnDevice(options: MLKitDetectFacesOnDeviceOptions): P
9193
leftEyeOpenProbability: face.hasLeftEyeOpenProbability ? face.leftEyeOpenProbability : undefined,
9294
rightEyeOpenProbability: face.hasRightEyeOpenProbability ? face.rightEyeOpenProbability : undefined,
9395
trackingId: face.hasTrackingID ? face.trackingID : undefined,
94-
bounds: face.frame
96+
bounds: face.frame,
97+
headEulerAngleY: face.headEulerAngleY,
98+
headEulerAngleZ: face.headEulerAngleZ
9599
});
96100
}
97101
resolve(result);

0 commit comments

Comments
 (0)