Java-Android camera2镜头固有校准
作者:互联网
我下载了一个Android camera2 demo,它运行良好.
现在,我想通过查询CameraCharacteristics获得摄像机的固有矩阵.
我的代码是
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
}
}
内在函数应为5元素数组,但内在= Characteristics.get(CameraCharacteristics.LENS_INTRINSIC_CALIBRATION)返回null.
解决方法:
只有在摄像头设备支持DEPTH_OUTPUT capability的情况下,才能保证定义镜头的固有特性.
截至目前,camera2 API的深度扩展是新的,并且基本上不受任何Android设备支持.
标签:android-camera2,android-hardware,android,java,android-camera 来源: https://codeday.me/bug/20191012/1902866.html