summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2014-05-20 15:28:53 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-05-20 00:30:27 -0700
commit7ded0c8cca20ef980af4de4ba6ca7bad48d817b3 (patch)
tree661ab91c5635122a1d7a3a0736bfe75efd4a2f00 /src
parent3aa258be27016c1a63c72bd4d14a6bb67e464590 (diff)
downloadandroid_packages_apps_Snap-7ded0c8cca20ef980af4de4ba6ca7bad48d817b3.tar.gz
android_packages_apps_Snap-7ded0c8cca20ef980af4de4ba6ca7bad48d817b3.tar.bz2
android_packages_apps_Snap-7ded0c8cca20ef980af4de4ba6ca7bad48d817b3.zip
Camera2: Fix face eyes display incorrect when face detection is on
There is no difference to the eye display when in horizontal screen and vertical screen. Add operations to display eyes line in horizontal screen. CRs-fixed: 637286 Change-Id: I5337fec876b3d868de9f3ba2f1b60a54810d8226
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/ui/FaceView.java66
1 files changed, 50 insertions, 16 deletions
diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java
index 7adabf2ad..1868e0a38 100644
--- a/src/com/android/camera/ui/FaceView.java
+++ b/src/com/android/camera/ui/FaceView.java
@@ -233,10 +233,19 @@ public class FaceView extends View
Log.e(TAG, "blink: (" + face.getLeftEyeBlinkDegree()+ ", " +
face.getRightEyeBlinkDegree() + ")");
if (face.leftEye != null) {
- point[0] = face.leftEye.x;
- point[1] = face.leftEye.y-delta_y/2;
- point[2] = face.leftEye.x;
- point[3] = face.leftEye.y+delta_y/2;
+ if ((mDisplayOrientation == 90) ||
+ (mDisplayOrientation == 270)) {
+ point[0] = face.leftEye.x;
+ point[1] = face.leftEye.y - delta_y / 2;
+ point[2] = face.leftEye.x;
+ point[3] = face.leftEye.y + delta_y / 2;
+ } else {
+ point[0] = face.leftEye.x - delta_x / 2;
+ point[1] = face.leftEye.y;
+ point[2] = face.leftEye.x + delta_x / 2;
+ point[3] = face.leftEye.y;
+
+ }
mMatrix.mapPoints (point);
if (face.getLeftEyeBlinkDegree() >= blink_threshold) {
canvas.drawLine(point[0]+ dx, point[1]+ dy,
@@ -244,10 +253,18 @@ public class FaceView extends View
}
}
if (face.rightEye != null) {
- point[0] = face.rightEye.x;
- point[1] = face.rightEye.y-delta_y/2;
- point[2] = face.rightEye.x;
- point[3] = face.rightEye.y+delta_y/2;
+ if ((mDisplayOrientation == 90) ||
+ (mDisplayOrientation == 270)) {
+ point[0] = face.rightEye.x;
+ point[1] = face.rightEye.y - delta_y / 2;
+ point[2] = face.rightEye.x;
+ point[3] = face.rightEye.y + delta_y / 2;
+ } else {
+ point[0] = face.rightEye.x - delta_x / 2;
+ point[1] = face.rightEye.y;
+ point[2] = face.rightEye.x + delta_x / 2;
+ point[3] = face.rightEye.y;
+ }
mMatrix.mapPoints (point);
if (face.getRightEyeBlinkDegree() >= blink_threshold) {
//Add offset to the points if the rect has an offset
@@ -286,20 +303,37 @@ public class FaceView extends View
(-length) + 0.5);
if (face.getLeftEyeBlinkDegree() < blink_threshold) {
- point[0] = face.leftEye.x;
- point[1] = face.leftEye.y;
- point[2] = face.leftEye.x + gazeRollX;
- point[3] = face.leftEye.y + gazeRollY;
+ if ((mDisplayOrientation == 90) ||
+ (mDisplayOrientation == 270)) {
+ point[0] = face.leftEye.x;
+ point[1] = face.leftEye.y;
+ point[2] = face.leftEye.x + gazeRollX;
+ point[3] = face.leftEye.y + gazeRollY;
+ } else {
+ point[0] = face.leftEye.x;
+ point[1] = face.leftEye.y;
+ point[2] = face.leftEye.x + gazeRollY;
+ point[3] = face.leftEye.y + gazeRollX;
+ }
mMatrix.mapPoints (point);
canvas.drawLine(point[0] +dx, point[1] + dy,
point[2] + dx, point[3] +dy, mPaint);
}
if (face.getRightEyeBlinkDegree() < blink_threshold) {
- point[0] = face.rightEye.x;
- point[1] = face.rightEye.y;
- point[2] = face.rightEye.x + gazeRollX;
- point[3] = face.rightEye.y + gazeRollY;
+ if ((mDisplayOrientation == 90) ||
+ (mDisplayOrientation == 270)) {
+ point[0] = face.rightEye.x;
+ point[1] = face.rightEye.y;
+ point[2] = face.rightEye.x + gazeRollX;
+ point[3] = face.rightEye.y + gazeRollY;
+ } else {
+ point[0] = face.rightEye.x;
+ point[1] = face.rightEye.y;
+ point[2] = face.rightEye.x + gazeRollY;
+ point[3] = face.rightEye.y + gazeRollX;
+
+ }
mMatrix.mapPoints (point);
canvas.drawLine(point[0] + dx, point[1] + dy,
point[2] + dx, point[3] + dy, mPaint);