我下载了一个Android camera2 演示版,运行良好.
现在我想通过查询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元素数组,但intrinsic = characteristics.get(CameraCharacteristics.LENS_INTRINSIC_CALIBRATION)
返回null.
如果摄像机设备支持DEPTH_OUTPUT功能,则仅保证定义镜头内在函数.
截至目前,camera2 API的深度扩展是新的,基本上任何Android设备都不支持.