android camera2如何实现连续捕获30张图片1秒

时间:2017-12-14 06:57:15

标签: android focus zoom radio android-camera2

保存位图时,它会出现错误。我想知道,如何实现连续捕获。我的操作是对的???帮助帮助 这是我的imagereader

//wight 480, height 640, format JPEG,maxnum 30
//when I set format is YUV_420_888, I donot know how to translate it 
//to bitmap,so I set it is JPEG
imageReader = ImageReader.newInstance(480, 640, ImageFormat.JPEG, 30);

try {
        //set Builder
        takePictureRequestBuilder = 
              mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);

        takePictureRequestBuilder.addTarget(imageReader.getSurface());            
        takePictureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                                          CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);

        takePictureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
                                               CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);

        int rotation = getWindowManager().getDefaultDisplay().getRotation();  

        takePictureRequestBuilder.set(CaptureRequest.JPEG_ORIENTATION, 
                                                       ORIENTATIONS.get(rotation));

        CaptureRequest mCaptureRequest = takePictureRequestBuilder.build();

        List<CaptureRequest> list = new LinkedList<>();
        for (int i = 0; i < 10; i++) {
            list.add(mCaptureRequest);
        }

        //set captureBurst
        mCameraCaptureSession.captureBurst(list,null,handler1);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }

0 个答案:

没有答案