我正在尝试使用camera2 API从相机捕获图像数据.我主要使用的是从
android Capture2RAW示例中获取的代码.在完全停止之前,只有少数图像通过(即调用on
ImageAvailable).我尝试使用不同大小的RAW_SENSOR和JPEG格式捕获相同的结果.我究竟做错了什么?
this.mImageReader = ImageReader.newInstance(width,height,ImageFormat.RAW_SENSOR,/*maxImages*/ 1); Surface surface = this.mImageReader.getSurface(); final List<Surface> surfaces = Arrays.asList(surface); this.mCamera.createCaptureSession(surfaces,new CameraCaptureSession.StateCallback() { // Callback methods here },null); CaptureRequest.Builder captureRequestBuilder; captureRequestBuilder = this.mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); captureRequestBuilder.addTarget(surface); this.mCaptureRequest = captureRequestBuilder.build(); this.mCaptureSession.setRepeatingRequest(mCaptureRequest,null,null);