使用camera2 API时,图像会交错

时间:2015-12-07 09:19:42

标签: android camera android-camera camera2 interlacing

我正在尝试使用camera2 api创建一个应用程序,我需要的是创建一个30 fps的爆发,我能够创建。

问题是预览图像和保存的图像交错(我拍摄了一些闪烁的LED,因此很容易看到)。 我尝试禁用自动曝光并自行设置灵敏度,但这并不起作用。

 private void captureStillPicture() {
    try {
        final Activity activity = getActivity();
        mPictureCounter = 0;
        if (null == activity || null == mCameraDevice) {
            return;
        }

        List<CaptureRequest> captureList = new ArrayList<CaptureRequest>();

        // This is the CaptureRequest.Builder that we use to take a picture.
        final CaptureRequest.Builder captureBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);

        // Use the same AE and AF modes as the preview.
        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO);
        captureBuilder.set(CaptureRequest.SENSOR_SENSITIVITY, 2000);
        //Auto focus - should keep that
        captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, Consts.aeMode);

        captureBuilder.addTarget(mImageReader.getSurface());

        for(int i = 0; i < Consts.frameAmount; i++) {
            captureList.add(captureBuilder.build());
        }

        CameraCaptureSession.CaptureCallback CaptureCallback = new CameraCaptureSession.CaptureCallback() {
            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                mPictureCounter++;
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.captureBurst(captureList, CaptureCallback, mBackgroundHandler);

    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}

有什么想法?

0 个答案:

没有答案