Sdílet prostřednictvím


Camera.StartFaceDetection Method

Definition

Caution

deprecated

Starts the face detection.

[Android.Runtime.Register("startFaceDetection", "()V", "")]
[System.Obsolete("deprecated")]
public void StartFaceDetection ();
[<Android.Runtime.Register("startFaceDetection", "()V", "")>]
[<System.Obsolete("deprecated")>]
member this.StartFaceDetection : unit -> unit
Attributes

Exceptions

if the face detection is unsupported.

if the method fails or the face detection is already running.

Remarks

Starts the face detection. This should be called after preview is started. The camera will notify FaceDetectionListener of the detected faces in the preview frame. The detected faces may be the same as the previous ones. Applications should call #stopFaceDetection to stop the face detection. This method is supported if 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, Parameters#setWhiteBalance(String), Parameters#setFocusAreas(List), and Parameters#setMeteringAreas(List) have no effect. The camera uses the detected faces to do auto-white balance, auto exposure, and autofocus.

If the apps call #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 #cancelAutoFocus(), the face callbacks will also resume.

After calling #takePicture(Camera.ShutterCallback, Camera.PictureCallback, Camera.PictureCallback) or #stopPreview(), and then resuming preview with #startPreview(), the apps should call this method again to resume face detection.

Java documentation for android.hardware.Camera.startFaceDetection().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also