[libcamera-devel] [PATCH v5 09/12] py: libcamera: Define and use Orientation
Tomi Valkeinen
tomi.valkeinen at ideasonboard.com
Mon Sep 4 19:04:33 CEST 2023
On 01/09/2023 18:02, Jacopo Mondi via libcamera-devel wrote:
> Define an enumeration type for Orientation and expose the
> CameraConfiguration::orientation property in place of
> CameraConfiguration::transform.
>
> Signed-off-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
> ---
> src/py/libcamera/py_enums.cpp | 10 ++++++++++
> src/py/libcamera/py_main.cpp | 2 +-
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp
> index 803c4e7ee362..3cf381e2eb84 100644
> --- a/src/py/libcamera/py_enums.cpp
> +++ b/src/py/libcamera/py_enums.cpp
> @@ -31,4 +31,14 @@ void init_py_enums(py::module &m)
> .value("String", ControlType::ControlTypeString)
> .value("Rectangle", ControlType::ControlTypeRectangle)
> .value("Size", ControlType::ControlTypeSize);
> +
> + py::enum_<Orientation>(m, "Orientation")
> + .value("Rotate0", Orientation::rotate0)
> + .value("Rotate0Flip", Orientation::rotate0Flip)
> + .value("Rotate180", Orientation::rotate180)
> + .value("Rotate180Flip", Orientation::rotate180Flip)
> + .value("Rotate90Flip", Orientation::rotate90Flip)
> + .value("Rotate270", Orientation::rotate270)
> + .value("Rotate270Flip", Orientation::rotate270Flip)
> + .value("Rotate90", Orientation::rotate90);
> }
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index 01fb15a9391c..63371dce38b3 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -293,7 +293,7 @@ PYBIND11_MODULE(_libcamera, m)
> py::return_value_policy::reference_internal)
> .def_property_readonly("size", &CameraConfiguration::size)
> .def_property_readonly("empty", &CameraConfiguration::empty)
> - .def_readwrite("transform", &CameraConfiguration::transform);
> + .def_readwrite("orientation", &CameraConfiguration::orientation);
>
> pyCameraConfigurationStatus
> .value("Valid", CameraConfiguration::Valid)
Reviewed-by: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
Tomi
More information about the libcamera-devel
mailing list