Camera FOV Calibration fail问题的解决

劳灵均
2023-12-01

操作步骤。。。

Camera
Camera FOV Calibration
利用A3 纸无缩放打印calibration-pattern.pdf 目标文件, 同时将它挂在墙上。
calibration-pattern.pdf 目标文件的地址如下:
https://static.googleusercontent.com/media/source.android.com/zh-CN//compatibility/
calibration-pattern.pdf
将待测设备的Camera 与打印好的目标文件按照下图进行放置:

 

---------------------------------------------------------------------------------------------

解决,用debug 版本,去修改vendor/etc/permissions/camer_config.xml文件,根据那个值去调整数值,改到能过就OK 

如果修改数值没有效果,需要合入以下patch

cts 修改FOV问题,提交logo

diff --git a/device/qcom/msm8953_64/splash.img b/device/qcom/msm8953_64/splash.img
index b134961..93e0574 100755
Binary files a/device/qcom/msm8953_64/splash.img and b/device/qcom/msm8953_64/splash.img differ
diff --git a/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.cpp b/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.cpp
old mode 100644
new mode 100755
index 28d186a..23f8677
--- a/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/frameworks/av/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -3271,6 +3271,27 @@ status_t Parameters::calculatePictureFovs(float *horizFov, float *vertFov)
                 atanf(vertCropFactor * sensorSize.data.f[1] /
                         (2 * fastInfo.defaultFocalLength));
     }
+
+	Vector<android::Size> pictureSizes;
+    params.getSupportedPictureSizes(pictureSizes);
+	arrayAspect = static_cast<float>(pictureSizes[0].width) / pictureSizes[0].height;
+	ALOGI("[xuhao] pictureSizes.width = %d, pictureSizes.height = %d \n", pictureSizes[0].width, pictureSizes[0].height);
+
+    horizCropFactor = (arrayAspect > stillAspect) ? (stillAspect / arrayAspect) : 1.f;
+    vertCropFactor = (arrayAspect < stillAspect) ? (arrayAspect / stillAspect) : 1.f;
+
+	#define PI 3.14159265
+
+	camera_metadata_ro_entry_t availableDac =
+        staticInfo(ANDROID_SENSOR_FOV, 0, 0, false);
+	float maxHfov = availableDac.data.f[0];
+	float maxVfov = availableDac.data.f[0];
+	ALOGI("[xuhao] 001 maxHfov = %f, maxVfov = %f \n", maxHfov, maxVfov);
+
+
+    *horizFov = (180/PI)*2*atan(horizCropFactor*tan((maxHfov/2)*(PI/180)));
+    *vertFov = (180/PI)*2*atan(horizCropFactor*tan((maxVfov/2)*(PI/180)));
+
     return OK;
 }
 
diff --git a/hardware/qcom/camera/QCamera2/HAL3/QCamera3HWI.cpp b/hardware/qcom/camera/QCamera2/HAL3/QCamera3HWI.cpp
index ae7d5e6..1b428af 100755
--- a/hardware/qcom/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/hardware/qcom/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -9473,10 +9473,14 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId)
     staticInfo.update(ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE,
                     &gCamCapability[cameraId]->hyper_focal_distance, 1);
 
+    /*Vector<float> availableFocalLength;
+    LOGE("[]xuhao] focal_length = %d, hor_view_angle = 5d, ver_view_angle = %d \n", gCamCapability[cameraId]->focal_length, gCamCapability[cameraId]->hor_view_angle, gCamCapability[cameraId]->ver_view_angle);
+    availableFocalLength.add(gCamCapability[cameraId]->focal_length);
+    availableFocalLength.add(gCamCapability[cameraId]->hor_view_angle);
+    availableFocalLength.add(gCamCapability[cameraId]->ver_view_angle);*/
     /*should be using focal lengths but sensor doesn't provide that info now*/
-    staticInfo.update(ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS,
-                      &gCamCapability[cameraId]->focal_length,
-                      1);
+    staticInfo.update(ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, &gCamCapability[cameraId]->focal_length, 1);
+	staticInfo.update(ANDROID_SENSOR_FOV, &gCamCapability[cameraId]->hor_view_angle, 1);
 
     staticInfo.update(ANDROID_LENS_INFO_AVAILABLE_APERTURES,
             gCamCapability[cameraId]->apertures,
@@ -9565,7 +9569,8 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId)
     // SOF timestamp is based on monotonic_boottime. So advertize REALTIME timesource
     // REALTIME defined in HAL3 API is same as linux's CLOCK_BOOTTIME
     // Ref: kernel/...../msm_isp_util.c: msm_isp_get_timestamp: get_monotonic_boottime
-    uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME;
+    uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;
+   //ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME;
     staticInfo.update(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,
             &timestampSource, 1);
 
@@ -10493,6 +10498,7 @@ int QCamera3HardwareInterface::initStaticMetadata(uint32_t cameraId)
        ANDROID_SENSOR_OPAQUE_RAW_SIZE,
        ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE,
 #endif
+       ANDROID_SENSOR_FOV,
        };
 
     Vector<int32_t> available_characteristics_keys;

diff --git a/system/media/camera/include/system/camera_metadata_tags.h b/system/media/camera/include/system/camera_metadata_tags.h
old mode 100644
new mode 100755
index adf18b8..a9b0d14
--- a/system/media/camera/include/system/camera_metadata_tags.h
+++ b/system/media/camera/include/system/camera_metadata_tags.h
@@ -328,6 +328,7 @@ typedef enum camera_metadata_tag {
     ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL,               // float[]      | public       | HIDL v3.2
     ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL,               // int32        | public       | HIDL v3.2
     ANDROID_SENSOR_OPAQUE_RAW_SIZE,                   // int32[]      | system       | HIDL v3.2
+	ANDROID_SENSOR_FOV,                               // float        | public       | HIDL v3.2
     ANDROID_SENSOR_END,
 
     ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE =           // int32[]      | public       | HIDL v3.2
diff --git a/system/media/camera/src/camera_metadata_tag_info.c b/system/media/camera/src/camera_metadata_tag_info.c
old mode 100644
new mode 100755
index 75ad1f4..338dcaa
--- a/system/media/camera/src/camera_metadata_tag_info.c
+++ b/system/media/camera/src/camera_metadata_tag_info.c
@@ -525,6 +525,8 @@ static tag_info_t android_sensor[ANDROID_SENSOR_END -
     { "dynamicWhiteLevel",             TYPE_INT32  },
     [ ANDROID_SENSOR_OPAQUE_RAW_SIZE - ANDROID_SENSOR_START ] =
     { "opaqueRawSize",                 TYPE_INT32  },
+	[ ANDROID_SENSOR_FOV - ANDROID_SENSOR_START ] =
+    { "FOV",                           TYPE_FLOAT  },
 };
 
 static tag_info_t android_sensor_info[ANDROID_SENSOR_INFO_END -
@@ -2251,7 +2253,9 @@ int camera_metadata_enum_snprint(uint32_t tag,
         case ANDROID_SENSOR_OPAQUE_RAW_SIZE: {
             break;
         }
-
+        case ANDROID_SENSOR_FOV: {
+            break;
+        }
         case ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE: {
             break;
         }

 

 

 

 类似资料: