相关疑难解决方法(0)

如何花时间直到焦点正在拍摄图像而不是拍照?camera2API

我使用相机2 API.

我使用标准谷歌样本的相机.

问题是代码允许用户拍照,即使图像不在焦点...

private final CameraCaptureSession.CaptureCallback mCaptureCallback
        = new CameraCaptureSession.CaptureCallback() {

    @Override
    public void onCaptureProgressed(@NonNull CameraCaptureSession session,
                                    @NonNull CaptureRequest request,
                                    @NonNull CaptureResult partialResult) {
    }

    @Override
    public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                   @NonNull CaptureRequest request,
                                   @NonNull TotalCaptureResult result) {
        process(result);
    }

    private void process(CaptureResult result) {
        switch (mState) {
            case CameraHelper.STATE_PREVIEW: {
                // We have nothing to do when the camera preview is working normally.

                break;
            }
            case CameraHelper.STATE_WAITING_LOCK: {
                Integer afState = result.get(CaptureResult.CONTROL_AF_STATE);
                if (afState == null) {
                    captureStillPicture(); …
Run Code Online (Sandbox Code Playgroud)

java camera android android-camera

5
推荐指数
0
解决办法
1176
查看次数

标签 统计

android ×1

android-camera ×1

camera ×1

java ×1