In-Camera 1, we have FaceDetectionListener
and camera.startFaceDetection()
method. Using this way it is easier to find faces.
In-camera 2, we can do the same using CameraCaptureSession.CaptureCallback() method and this static variable
Integer mode = result.get(CaptureResult.STATISTICS_FACE_DETECT_MODE);
Face[] faces = result.get(CaptureResult.STATISTICS_FACES);
Now there is a new Camera library called CameraX. It is a wrapper of Camera2 and recommended to use.
If it is a wrapper of Camera 2, we can easily get the callback result of CameraCaptureSession.CaptureCallback()
But After 3 days of trying I have failed to find a solution.
Can anyone give me the solution to call the below method as camera2 does?
In Camera2,
private val mCaptureCallback = object : CameraCaptureSession.CaptureCallback() {
override fun onCaptureProgressed(
session: CameraCaptureSession,
request: CaptureRequest,
partialResult: CaptureResult
) {
}
override fun onCaptureCompleted(
session: CameraCaptureSession,
request: CaptureRequest,
result: TotalCaptureResult
) {
}
}
mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback,
mBackgroundHandler);
How to get the callback result using CameraX?