[libcamera-devel] [RFC 0/4] prototype python bindings
Tomi Valkeinen
tomi.valkeinen at iki.fi
Fri Oct 2 13:34:32 CEST 2020
Hi,
I have continued this work, and my latest branch is available at:
https://github.com/tomba/libcamera py
Don't look at the history, it's full of "some work" commit messages, as I'm still experimenting with
different approaches.
Some of the changes since the first version:
- move under src/
- add pybind11 via meson subproject
- the binding covers much more of the libcamera API
- simplecamera.py, an attempt to expose a single-stream simple-to-use camera class
- qtest.sh, show the captured images with Qt, and show camera controls as sliders, using simplecamera.py
Mainly tested with vimc, and a bit with vivid and my laptop's camera.
Tomi
On 18/09/2020 18:20, Tomi Valkeinen wrote:
> Hi,
>
> Laurent asked me to send these to get discussions about the challenges
> on the list (rather than in private chats...).
>
> This is a prototype, RFC, hack, whatever you want to call it, but it
> works for me for the small subset of features used in test.py.
>
> The main patch "libcamera python bindings" has some questions/issues
> listed in the description, and I've added comments to the code where I'm
> not sure where to go.
>
> There were no submodules in libcamera, so I used the same convention
> I've used in kms++: ext/<submodule>. pybind11 could be added as
> something that comes from the system (at least Ubuntu 20.04 has it), but
> as it's header only, I think having it as a submodule is the easiest and
> most manageable way to add it.
>
> Tomi
>
> Tomi Valkeinen (4):
> Add pybind11 submodule
> Add BoundMethodFunction
> hack: Camera public destructor
> libcamera python bindings
>
> .gitmodules | 3 +
> ext/pybind11 | 1 +
> include/libcamera/bound_method.h | 25 +++++
> include/libcamera/camera.h | 2 +-
> include/libcamera/signal.h | 6 ++
> meson.build | 1 +
> meson_options.txt | 2 +
> py/meson.build | 1 +
> py/pycamera/__init__.py | 29 +++++
> py/pycamera/meson.build | 35 ++++++
> py/pycamera/pymain.cpp | 169 +++++++++++++++++++++++++++++
> py/test/run-valgrind.sh | 3 +
> py/test/run.sh | 3 +
> py/test/test.py | 177 +++++++++++++++++++++++++++++++
> py/test/valgrind-pycamera.supp | 17 +++
> 15 files changed, 473 insertions(+), 1 deletion(-)
> create mode 100644 .gitmodules
> create mode 160000 ext/pybind11
> create mode 100644 py/meson.build
> create mode 100644 py/pycamera/__init__.py
> create mode 100644 py/pycamera/meson.build
> create mode 100644 py/pycamera/pymain.cpp
> create mode 100755 py/test/run-valgrind.sh
> create mode 100755 py/test/run.sh
> create mode 100755 py/test/test.py
> create mode 100644 py/test/valgrind-pycamera.supp
>
More information about the libcamera-devel
mailing list