@@ -940,6 +940,15 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
};
staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
data.data(), data.size());
+
+ std::vector<float> physicalSize(2);
+ if (properties.contains(properties::UnitCellSize)) {
+ const Size &unitCellSize =
+ properties.get<Size>(properties::UnitCellSize);
+ physicalSize[0] = unitCellSize.width * pixelArraySize[0] / 1e6f;
+ physicalSize[1] = unitCellSize.height * pixelArraySize[1] / 1e6f;
+ staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,
+ physicalSize.data(), physicalSize.size());
}
{
@@ -987,13 +996,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
testPatterModes.data(),
testPatterModes.size());
- std::vector<float> physicalSize = {
- 2592, 1944,
- };
- staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,
- physicalSize.data(),
- physicalSize.size());
-
uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;
staticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,
×tampSource, 1);
Calculate the value of the ANDROID_SENSOR_INFO_PHYSICAL_SIZE property multiplying the number of sensor's readable pixels with the pixel unit cell size if provided by the Camera. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/android/camera_device.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)