summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-11-15 06:14:11 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-15 06:14:11 -0800
commitb90a70d1542edd5a95e73b75192e6eb5a66401cc (patch)
treeb40613693e6017e18fd76e7e9990d474586d6827 /core
parent4b7494e07a44c0aa363379be463de70455a895f3 (diff)
parent8c13670c13a7a965884d92193b039e26c96b95c6 (diff)
downloadframeworks_base-b90a70d1542edd5a95e73b75192e6eb5a66401cc.zip
frameworks_base-b90a70d1542edd5a95e73b75192e6eb5a66401cc.tar.gz
frameworks_base-b90a70d1542edd5a95e73b75192e6eb5a66401cc.tar.bz2
Merge "Improve camera face detection javadoc." into ics-mr1
Diffstat (limited to 'core')
-rw-r--r--core/java/android/hardware/Camera.java43
1 files changed, 36 insertions, 7 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 3becec0..c2a757f 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1111,9 +1111,21 @@ public class Camera {
* Parameters#getMaxNumDetectedFaces()} returns a number larger than 0.
* If the face detection has started, apps should not call this again.
*
- * When the face detection is running, {@link Parameters#setWhiteBalance(String)},
+ * <p>When the face detection is running, {@link Parameters#setWhiteBalance(String)},
* {@link Parameters#setFocusAreas(List)}, and {@link Parameters#setMeteringAreas(List)}
- * have no effect.
+ * have no effect. The camera uses the detected faces to do auto-white balance,
+ * auto exposure, and autofocus.
+ *
+ * <p>If the apps call {@link #autoFocus(AutoFocusCallback)}, the camera
+ * will stop sending face callbacks. The last face callback indicates the
+ * areas used to do autofocus. After focus completes, face detection will
+ * resume sending face callbacks. If the apps call {@link
+ * #cancelAutoFocus()}, the face callbacks will also resume.</p>
+ *
+ * <p>After calling {@link #takePicture(Camera.ShutterCallback, Camera.PictureCallback,
+ * Camera.PictureCallback)} or {@link #stopPreview()}, and then resuming
+ * preview with {@link #startPreview()}, the apps should call this method
+ * again to resume face detection.</p>
*
* @throws IllegalArgumentException if the face detection is unsupported.
* @throws RuntimeException if the method fails or the face detection is
@@ -1163,14 +1175,31 @@ public class Camera {
* camera field of view, and (1000, 1000) represents the bottom-right of
* the field of view. For example, suppose the size of the viewfinder UI
* is 800x480. The rect passed from the driver is (-1000, -1000, 0, 0).
- * The corresponding viewfinder rect should be (0, 0, 400, 240). The
- * width and height of the rect will not be 0 or negative. The
- * coordinates can be smaller than -1000 or bigger than 1000. But at
- * least one vertex will be within (-1000, -1000) and (1000, 1000).
+ * The corresponding viewfinder rect should be (0, 0, 400, 240). It is
+ * guaranteed left < right and top < bottom. The coordinates can be
+ * smaller than -1000 or bigger than 1000. But at least one vertex will
+ * be within (-1000, -1000) and (1000, 1000).
*
* <p>The direction is relative to the sensor orientation, that is, what
* the sensor sees. The direction is not affected by the rotation or
- * mirroring of {@link #setDisplayOrientation(int)}.</p>
+ * mirroring of {@link #setDisplayOrientation(int)}. The face bounding
+ * rectangle does not provide any information about face orientation.</p>
+ *
+ * <p>Here is the matrix to convert driver coordinates to View coordinates
+ * in pixels.</p>
+ * <pre>
+ * Matrix matrix = new Matrix();
+ * CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId];
+ * // Need mirror for front camera.
+ * boolean mirror = (info.facing == CameraInfo.CAMERA_FACING_FRONT);
+ * matrix.setScale(mirror ? -1 : 1, 1);
+ * // This is the value for android.hardware.Camera.setDisplayOrientation.
+ * matrix.postRotate(displayOrientation);
+ * // Camera driver coordinates range from (-1000, -1000) to (1000, 1000).
+ * // UI coordinates range from (0, 0) to (width, height).
+ * matrix.postScale(view.getWidth() / 2000f, view.getHeight() / 2000f);
+ * matrix.postTranslate(view.getWidth() / 2f, view.getHeight() / 2f);
+ * </pre>
*
* @see #startFaceDetection()
*/