[libcamera-devel,v4,0/5] Python bindings
mbox series

Message ID 20220204133814.303217-1-tomi.valkeinen@ideasonboard.com
Headers show
Series
  • Python bindings
Related show

Message

Tomi Valkeinen Feb. 4, 2022, 1:38 p.m. UTC
Hi,

v4 of the RFC. I'm still not calling this "PATCH" due to the two hacks
in the series. I have not had too much time to work on this, but I
wanted to fix the easy ones.

Changes in this version:
- Add unittests.py
- Move cam.py files under a separate dir
- Rename the python module to "libcamera"
- Support array controls
- Rename StreamConfiguration.fmt to pixelFormat
- Cosmetic changes all around
- Rebased to latest master (and fixed the issues)

The two major issues not solved are related to the two HACK patches in
the series. I don't have a good solution for the Camera destructor
issue, although I did add a link to a pybind11 pull request which does
fix it. The other issue, exposing Camera from Request, should be
fixable, but needs a real amount of work.

I have tested this only on my PC. Unfortunately I wasn't able to run
libcamera on RPi anymore. I guess I need a custom built kernel now?

 Tomi

Tomi Valkeinen (5):
  HACK: libcamera: Camera public destructor
  HACK: libcamera: Request: expose Camera from Request
  Add Python bindings
  py: add unittests.py
  py: Add cam.py

 include/libcamera/camera.h   |   2 +-
 include/libcamera/request.h  |   2 +
 meson.build                  |   1 +
 meson_options.txt            |   5 +
 src/libcamera/request.cpp    |   5 +
 src/meson.build              |   1 +
 src/py/cam/cam.py            | 461 +++++++++++++++++++++++++++++++++++
 src/py/cam/cam_kms.py        | 183 ++++++++++++++
 src/py/cam/cam_null.py       |  46 ++++
 src/py/cam/cam_qt.py         | 355 +++++++++++++++++++++++++++
 src/py/cam/cam_qtgl.py       | 386 +++++++++++++++++++++++++++++
 src/py/cam/gl_helpers.py     |  67 +++++
 src/py/libcamera/__init__.py |  10 +
 src/py/libcamera/meson.build |  41 ++++
 src/py/libcamera/pymain.cpp  | 440 +++++++++++++++++++++++++++++++++
 src/py/meson.build           |   1 +
 src/py/test/unittests.py     | 366 +++++++++++++++++++++++++++
 subprojects/.gitignore       |   3 +-
 subprojects/pybind11.wrap    |  12 +
 19 files changed, 2385 insertions(+), 2 deletions(-)
 create mode 100755 src/py/cam/cam.py
 create mode 100644 src/py/cam/cam_kms.py
 create mode 100644 src/py/cam/cam_null.py
 create mode 100644 src/py/cam/cam_qt.py
 create mode 100644 src/py/cam/cam_qtgl.py
 create mode 100644 src/py/cam/gl_helpers.py
 create mode 100644 src/py/libcamera/__init__.py
 create mode 100644 src/py/libcamera/meson.build
 create mode 100644 src/py/libcamera/pymain.cpp
 create mode 100644 src/py/meson.build
 create mode 100755 src/py/test/unittests.py
 create mode 100644 subprojects/pybind11.wrap

Comments

David Plowman Feb. 4, 2022, 3:17 p.m. UTC | #1
Hi Tomi

I don't think you should need a custom built kernel, but perhaps you just
need an up to date one? Either flash a new SD card with the new Bullseye
that we released on 28/1 (that's the one the RPi Imager tool should pick),
or maybe "sudo apt update" and "sudo apt dist-upgrade" will work. If that
still doesn't work, maybe post the error messages.

David

On Fri, 4 Feb 2022 at 13:38, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
wrote:

> Hi,
>
> v4 of the RFC. I'm still not calling this "PATCH" due to the two hacks
> in the series. I have not had too much time to work on this, but I
> wanted to fix the easy ones.
>
> Changes in this version:
> - Add unittests.py
> - Move cam.py files under a separate dir
> - Rename the python module to "libcamera"
> - Support array controls
> - Rename StreamConfiguration.fmt to pixelFormat
> - Cosmetic changes all around
> - Rebased to latest master (and fixed the issues)
>
> The two major issues not solved are related to the two HACK patches in
> the series. I don't have a good solution for the Camera destructor
> issue, although I did add a link to a pybind11 pull request which does
> fix it. The other issue, exposing Camera from Request, should be
> fixable, but needs a real amount of work.
>
> I have tested this only on my PC. Unfortunately I wasn't able to run
> libcamera on RPi anymore. I guess I need a custom built kernel now?
>
>  Tomi
>
> Tomi Valkeinen (5):
>   HACK: libcamera: Camera public destructor
>   HACK: libcamera: Request: expose Camera from Request
>   Add Python bindings
>   py: add unittests.py
>   py: Add cam.py
>
>  include/libcamera/camera.h   |   2 +-
>  include/libcamera/request.h  |   2 +
>  meson.build                  |   1 +
>  meson_options.txt            |   5 +
>  src/libcamera/request.cpp    |   5 +
>  src/meson.build              |   1 +
>  src/py/cam/cam.py            | 461 +++++++++++++++++++++++++++++++++++
>  src/py/cam/cam_kms.py        | 183 ++++++++++++++
>  src/py/cam/cam_null.py       |  46 ++++
>  src/py/cam/cam_qt.py         | 355 +++++++++++++++++++++++++++
>  src/py/cam/cam_qtgl.py       | 386 +++++++++++++++++++++++++++++
>  src/py/cam/gl_helpers.py     |  67 +++++
>  src/py/libcamera/__init__.py |  10 +
>  src/py/libcamera/meson.build |  41 ++++
>  src/py/libcamera/pymain.cpp  | 440 +++++++++++++++++++++++++++++++++
>  src/py/meson.build           |   1 +
>  src/py/test/unittests.py     | 366 +++++++++++++++++++++++++++
>  subprojects/.gitignore       |   3 +-
>  subprojects/pybind11.wrap    |  12 +
>  19 files changed, 2385 insertions(+), 2 deletions(-)
>  create mode 100755 src/py/cam/cam.py
>  create mode 100644 src/py/cam/cam_kms.py
>  create mode 100644 src/py/cam/cam_null.py
>  create mode 100644 src/py/cam/cam_qt.py
>  create mode 100644 src/py/cam/cam_qtgl.py
>  create mode 100644 src/py/cam/gl_helpers.py
>  create mode 100644 src/py/libcamera/__init__.py
>  create mode 100644 src/py/libcamera/meson.build
>  create mode 100644 src/py/libcamera/pymain.cpp
>  create mode 100644 src/py/meson.build
>  create mode 100755 src/py/test/unittests.py
>  create mode 100644 subprojects/pybind11.wrap
>
> --
> 2.25.1
>
>