summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-10-19 16:01:25 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-10-23 16:05:57 +0300
commit568569b0815aab15096fd87d8cc4d79155cb8e93 (patch)
tree58baae7a976a06f8fbfc387b0a376f34418b29a3
parent891720ae8c7c616660a8400855cf8a9f408902cc (diff)
libcamera: properties: Make 'Rotation' the mounting rotation
Specify in the documentation that properties::Rotation specifies the mounting rotation of the camera module. This avoids confusion with the image orientation which is instead expressed by CameraConfiguration::orientation. For this reason, do not compensate the Rotation property when initializing the CameraSensor class but report the value of V4L2_CID_CAMERA_SENSOR_ROTATION or 0 if the control is not available. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/camera_sensor.cpp15
-rw-r--r--src/libcamera/property_ids.yaml8
2 files changed, 7 insertions, 16 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index e3826ceb..8ff72b42 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -433,11 +433,11 @@ int CameraSensor::initProperties()
/* Retrieve and register properties from the kernel interface. */
const ControlInfoMap &controls = subdev_->controls();
- int32_t propertyValue;
const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);
if (orientation != controls.end()) {
int32_t v4l2Orientation = orientation->second.def().get<int32_t>();
+ int32_t propertyValue;
switch (v4l2Orientation) {
default:
@@ -462,7 +462,7 @@ int CameraSensor::initProperties()
const auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION);
if (rotationControl != controls.end()) {
- propertyValue = rotationControl->second.def().get<int32_t>();
+ int32_t propertyValue = rotationControl->second.def().get<int32_t>();
/*
* Cache the Transform associated with the camera mounting
@@ -477,20 +477,11 @@ int CameraSensor::initProperties()
rotationTransform_ = Transform::Identity;
}
- /*
- * Adjust property::Rotation as validateTransform() compensates
- * for the mounting rotation. However, as a camera sensor can
- * only compensate rotations by applying H/VFlips, only rotation
- * of 180 degrees are automatically compensated. The other valid
- * rotations (Rot90 and Rot270) require transposition, which the
- * camera sensor cannot perform, so leave them untouched.
- */
- if (propertyValue == 180 && supportFlips_)
- propertyValue = 0;
properties_.set(properties::Rotation, propertyValue);
} else {
LOG(CameraSensor, Warning)
<< "Rotation control not available, default to 0 degrees";
+ properties_.set(properties::Rotation, 0);
rotationTransform_ = Transform::Identity;
}
diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml
index 5bddafc2..f3556384 100644
--- a/src/libcamera/property_ids.yaml
+++ b/src/libcamera/property_ids.yaml
@@ -29,10 +29,10 @@ controls:
- Rotation:
type: int32_t
description: |
- The camera rotation is expressed as the angular difference in degrees
- between two reference systems, one relative to the camera module, and
- one defined on the external world scene to be captured when projected
- on the image sensor pixel array.
+ The camera physical mounting rotation. It is expressed as the angular
+ difference in degrees between two reference systems, one relative to the
+ camera module, and one defined on the external world scene to be
+ captured when projected on the image sensor pixel array.
A camera sensor has a 2-dimensional reference system 'Rc' defined by
its pixel array read-out order. The origin is set to the first pixel