use of android.hardware.Camera.FaceDetectionListener in project android_packages_apps_Camera by CyanogenMod.
the class PhotoModule method startFaceDetection.
@TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void startFaceDetection() {
if (!ApiHelper.HAS_FACE_DETECTION)
return;
// Workaround for a buggy camera library
if (Util.noFaceDetectOnFrontCamera() && (CameraHolder.instance().getCameraInfo()[mCameraId].facing == CameraInfo.CAMERA_FACING_FRONT)) {
return;
}
if (mFaceDetectionStarted || mCameraState != IDLE)
return;
if (mParameters.getMaxNumDetectedFaces() > 0) {
mFaceDetectionStarted = true;
mFaceView.clear();
mFaceView.setVisibility(View.VISIBLE);
mFaceView.setDisplayOrientation(mDisplayOrientation);
CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
mFaceView.setMirror(info.facing == CameraInfo.CAMERA_FACING_FRONT);
mFaceView.resume();
mFocusManager.setFaceView(mFaceView);
mCameraDevice.setFaceDetectionListener(new FaceDetectionListener() {
@Override
public void onFaceDetection(Face[] faces, android.hardware.Camera camera) {
mFaceView.setFaces(faces);
}
});
mCameraDevice.startFaceDetection();
}
}
Aggregations