Android camera2 Lens intrinsic calibration

2019-03-02 01:34发布

I downloaded an Android camera2 demo, it ran well.

Now I want to get the intrinsic matrix of the camera by querying the CameraCharacteristics.

My code is

private void setUpCameraOutputs(int width, int height) {
    Activity activity = getActivity();
    CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
    try {
        for (String cameraId : manager.getCameraIdList()) {
            CameraCharacteristics characteristics
                    = manager.getCameraCharacteristics(cameraId);
            float[] intrinsic = new float[5];
            intrinsic = characteristics.get(CameraCharacteristics.LENS_INTRINSIC_CALIBRATION);
    //...... leave out the following part
        }
    }

The intrinsic is expected to be a 5-element array but intrinsic = characteristics.get(CameraCharacteristics.LENS_INTRINSIC_CALIBRATION) returns null.

1条回答
做自己的国王
2楼-- · 2019-03-02 02:06

The lens intrinsics are only guaranteed to be defined if the camera device supports the DEPTH_OUTPUT capability.

As of right now, the depth extensions to the camera2 API are new, and not yet supported by basically any Android device.

查看更多
登录 后发表回答