2

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.

Dennis Kriechel
  • 3,719
  • 14
  • 40
  • 62
Huayu Zhang
  • 207
  • 4
  • 11
  • Does your device claim full support of camera2 API? – Alex Cohn Dec 03 '15 at 18:17
  • 1
    How to claim the support? I have already add `` in the manifest.xml – Huayu Zhang Dec 03 '15 at 18:46
  • Many devices today only have [crippled implementations](http://www.dpreview.com/forums/post/55600463) of camera2 API. There is nothing you can do about it, only choose one of the few devices that are ahead of the heard. – Alex Cohn Dec 03 '15 at 19:03

1 Answers1

8

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.

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47