How i can correctly set up CONTROL_SCENE_MODE_ACTION camera2API?

与世无争的帅哥 提交于 2019-12-25 16:50:56

问题


I need to set up CONTROL_SCENE_MODE_ACTION for my app camera2API.

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...

There are 2 question:

  1. Where exacly i have to set up this mode
  2. How i can check that it is working

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

Thanks in advance


回答1:


You can modify Camera2BasicFragment from Google Camera2Basic sample by add line

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

just after line

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

in onConfigured() method of example

@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();
    }
}


来源:https://stackoverflow.com/questions/40259844/how-i-can-correctly-set-up-control-scene-mode-action-camera2api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!