I ran into a problem with slow focus on Nexus 6. I am developing a camera application and now I am using the camera API2.
For applications, we create a preview request with 2 surfaces - SurfaceView (viewfinder) - YUV ImageReader surface (to use data when calculating hstogram)
And there is a critical point! If you just add only the surface of the viewfinder, focusing happens as usual. But with these 2 surfaces, focusing is very slow with the visual steps of moving the lens!
The code is pretty standard written in google docs:
mImageReaderPreviewYUV = ImageReader.newInstance(previewWidth, previewHeight, ImageFormat.YUV_420_888, 2);
previewRequestBuilder = camDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
previewRequestBuilder.addTarget(getCameraSurface()); //Add surface of SurfaceView
previewRequestBuilder.addTarget(mImageReaderPreviewYUV); //Add ImageReader
mCaptureSession.setRepeatingRequest(previewRequestBuilder.build(), captureCallback null);
source
share