android.hardware.camera2面对识别

时间:2016-02-26 18:16:53

标签: android camera detection face-recognition

我遇到问题:

Face[] faces = result.get(CaptureResult.STATISTICS_FACES);

因为它总是返回长度0;

这是我的初始化:

mPreviewRequestBuilder.set(CaptureRequest.STATISTICS_FACE_DETECT_MODE,CameraMetadata.STATISTICS_FACE_DETECT_MODE_SIMPLE); 

mPreviewRequest = mPreviewRequestBuilder.build(); mCaptureSession.setRepeatingRequest(mPreviewRequest,mCaptureCallback,mBackgroundHandler);

这是我的回调部分:

private CameraCaptureSession.CaptureCallback mCaptureCallback = new CameraCaptureSession.CaptureCallback() {

@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    Face[] faces = result.get(CaptureResult.STATISTICS_FACES);
    // face.length is always 0
}

我正确看到相机预览

知道错过了什么吗?

0 个答案:

没有答案