问题
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:
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.
来源:https://stackoverflow.com/questions/34070557/android-camera2-lens-intrinsic-calibration