[libcamera-devel] [PATCH] py: Add the SensorConfiguration class

Naushir Patuck naush at raspberrypi.com
Thu Sep 28 11:52:48 CEST 2023


Hi David,

Thank you for your patch.

On Thu, 28 Sept 2023 at 10:45, David Plowman via libcamera-devel
<libcamera-devel at lists.libcamera.org> wrote:
>
> We provide access to the bitDepth and outputSize fields of the new
> SensorConfiguration class. The class also needs a constructor so that
> Python applications can make one and put it into the
> CameraConfiguration.
>
> Signed-off-by: David Plowman <david.plowman at raspberrypi.com>

Reviewed-by: Naushir Patuck <naush at raspberrypi.com>

> ---
>  src/py/libcamera/py_main.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index 01fb15a9..8df04520 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -112,6 +112,7 @@ PYBIND11_MODULE(_libcamera, m)
>
>         auto pyCameraManager = py::class_<PyCameraManager, std::shared_ptr<PyCameraManager>>(m, "CameraManager");
>         auto pyCamera = py::class_<Camera, PyCameraSmartPtr<Camera>>(m, "Camera");
> +       auto pySensorConfiguration = py::class_<SensorConfiguration>(m, "SensorConfiguration");
>         auto pyCameraConfiguration = py::class_<CameraConfiguration>(m, "CameraConfiguration");
>         auto pyCameraConfigurationStatus = py::enum_<CameraConfiguration::Status>(pyCameraConfiguration, "Status");
>         auto pyStreamConfiguration = py::class_<StreamConfiguration>(m, "StreamConfiguration");
> @@ -281,6 +282,11 @@ PYBIND11_MODULE(_libcamera, m)
>                         return ret;
>                 });
>
> +       pySensorConfiguration
> +               .def(py::init<>())
> +               .def_readwrite("bit_depth", &SensorConfiguration::bitDepth)
> +               .def_readwrite("output_size", &SensorConfiguration::outputSize);
> +
>         pyCameraConfiguration
>                 .def("__iter__", [](CameraConfiguration &self) {
>                         return py::make_iterator<py::return_value_policy::reference_internal>(self);
> @@ -293,6 +299,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("sensor_config", &CameraConfiguration::sensorConfig)
>                 .def_readwrite("transform", &CameraConfiguration::transform);
>
>         pyCameraConfigurationStatus
> --
> 2.39.2
>


More information about the libcamera-devel mailing list