本文介绍了如何正确设置CONTROL_SCENE_MODE_ACTION camera2API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我的应用程序camera2API设置CONTROL_SCENE_MODE_ACTION.

I need to set up CONTROL_SCENE_MODE_ACTION for my app camera2API.

我尝试将其设置为captureStillPicture()方法,然后将其设置为lockFocus()方法,然后设置为stateCallback,但此方法不起作用...

i tryed to set it captureStillPicture() method then in lockFocus() method then in stateCallback but is doesn't work...

在文档中,我仅能找到它的解释,但是任何行都必须说明如何设置此模式...

In documentation i found only explanation what it is, but any lines how this mode have to be set up...

有2个问题:

  1. 我必须在哪里设置此模式
  2. 我如何检查其是否正常

或者您可以建议我如何重新利用曝光时间...

Or maybe you can suggest me how to reduse expose time...

预先感谢

推荐答案

您可以修改 Camera2BasicFragment 来自 Google Camera2Basic示例添加行

mPreviewRequestBuilder.set(CaptureRequest.CONTROL_SCENE_MODE, CaptureRequest.CONTROL_SCENE_MODE_ACTION);

紧随行

mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);

在示例的onConfigured()方法中

@Override
public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
    // The camera is already closed
    if (null == mCameraDevice) {
        return;
    }

    // When the session is ready, we start displaying the preview.
    mCaptureSession = cameraCaptureSession;
    try {
        // Auto focus should be continuous for camera preview.
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_SCENE_MODE,
                CaptureRequest.CONTROL_SCENE_MODE_ACTION);
        // Flash is automatically enabled when necessary.
        setAutoFlash(mPreviewRequestBuilder);

        // Finally, we start displaying the camera preview.
        mPreviewRequest = mPreviewRequestBuilder.build();
        mCaptureSession.setRepeatingRequest(mPreviewRequest,
                mCaptureCallback, mBackgroundHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}

这篇关于如何正确设置CONTROL_SCENE_MODE_ACTION camera2API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 02:16