camera2人脸检测回电 [英] camera2 face detection call back
问题描述
我正在尝试在camera2 API中使用面部检测器.我将预览生成器设置为使用面部检测器:
I'm trying to use the face detector in the camera2 api. I set the preview builder to use the face detector:
previewBuilder.set(CaptureRequest.STATISTICS_FACE_DETECT_MODE,
CameraMetadata.STATISTICS_FACE_DETECT_MODE_FULL);
CR = previewBuilder.build();
CS = session;
CS.setRepeatingRequest(CR, CScallback, null);
但是我不知道该代码在检测到人脸时会在哪里击中?它会在CameraCaptureSession.CaptureCallback中返回人脸吗?它在哪里将有关检测到的面部的信息发送回去?
But I don't understand where the code hits when it detects a face? Does it return a face in the CameraCaptureSession.CaptureCallback? Where does it send back the info about the detected faces?
推荐答案
http://developer.android.com/reference/android/hardware/camera2/CaptureResult.html
因此,面部数据似乎仅在拍摄照片后可用,或者换句话说,在进行预览时不可用.当您为预览生成器设置人脸检测模式时,这意味着拍摄照片时,捕获结果将获取元数据.我将尝试找到一种在预览时执行此操作的方法,我想我可以拍摄预览快照并使用后台线程运行人脸检测.对于这种情况,我将打开一个单独的问题.
So it seems that the face data is only available after the picture is taken or in other words not while the preview is happening. When you set face detect mode on for the preview builder that means the captureresult will get the metadata when the picture is taken. I will try to find a way to do it while in preview, I think I can take snapshots of the preview and run a face detection using a background thread. I will open a separate question for that scenario.
这篇关于camera2人脸检测回电的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!