Git Product home page Git Product logo

libcamera's Introduction

libcamera

A complex camera support library for Linux, Android, and ChromeOS

Cameras are complex devices that need heavy hardware image processing operations. Control of the processing is based on advanced algorithms that must run on a programmable processor. This has traditionally been implemented in a dedicated MCU in the camera, but in embedded devices algorithms have been moved to the main CPU to save cost. Blurring the boundary between camera devices and Linux often left the user with no other option than a vendor-specific closed-source solution.

To address this problem the Linux media community has very recently started collaboration with the industry to develop a camera stack that will be open-source-friendly while still protecting vendor core IP. libcamera was born out of that collaboration and will offer modern camera support to Linux-based systems, including traditional Linux distributions, ChromeOS and Android.

Getting Started

To fetch the sources, build and install:

git clone https://git.libcamera.org/libcamera/libcamera.git
cd libcamera
meson setup build
ninja -C build install

Dependencies

The following Debian/Ubuntu packages are required for building libcamera. Other distributions may have differing package names:

A C++ toolchain: [required]

Either {g++, clang}

Meson Build system: [required]

meson (>= 0.60) ninja-build pkg-config

for the libcamera core: [required]

libyaml-dev python3-yaml python3-ply python3-jinja2

for IPA module signing: [recommended]

Either libgnutls28-dev or libssl-dev, openssl

Without IPA module signing, all IPA modules will be isolated in a separate process. This adds an unnecessary extra overhead at runtime.

for improved debugging: [optional]

libdw-dev libunwind-dev

libdw and libunwind provide backtraces to help debugging assertion failures. Their functions overlap, libdw provides the most detailed information, and libunwind is not needed if both libdw and the glibc backtrace() function are available.

for device hotplug enumeration: [optional]

libudev-dev

for documentation: [optional]

python3-sphinx doxygen graphviz texlive-latex-extra

for gstreamer: [optional]

libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

for Python bindings: [optional]

libpython3-dev pybind11-dev

for cam: [optional]

libevent-dev is required to support cam, however the following optional dependencies bring more functionality to the cam test tool:

  • libdrm-dev: Enables the KMS sink
  • libjpeg-dev: Enables MJPEG on the SDL sink
  • libsdl2-dev: Enables the SDL sink
for qcam: [optional]

libtiff-dev qtbase5-dev qttools5-dev-tools

for tracing with lttng: [optional]

liblttng-ust-dev python3-jinja2 lttng-tools

for android: [optional]

libexif-dev libjpeg-dev

for Python bindings: [optional]

pybind11-dev

for lc-compliance: [optional]

libevent-dev libgtest-dev

for abi-compat.sh: [optional]

abi-compliance-checker

Basic testing with cam utility

The cam utility can be used for basic testing. You can list the cameras detected on the system with cam -l, and capture ten frames from the first camera and save them to disk with cam -c 1 --capture=10 --file. See cam -h for more information about the cam tool.

In case of problems, a detailed debug log can be obtained from libcamera by setting the LIBCAMERA_LOG_LEVELS environment variable:

:~$ LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l

Using GStreamer plugin

To use the GStreamer plugin from the source tree, use the meson devenv command. This will create a new shell instance with the GST_PLUGIN_PATH environment set accordingly.

meson devenv -C build

The debugging tool gst-launch-1.0 can be used to construct a pipeline and test it. The following pipeline will stream from the camera named "Camera 1" onto the OpenGL accelerated display element on your system.

gst-launch-1.0 libcamerasrc camera-name="Camera 1" ! queue ! glimagesink

To show the first camera found you can omit the camera-name property, or you can list the cameras and their capabilities using:

gst-device-monitor-1.0 Video

This will also show the supported stream sizes which can be manually selected if desired with a pipeline such as:

gst-launch-1.0 libcamerasrc ! 'video/x-raw,width=1280,height=720' ! \
     queue ! glimagesink

The libcamerasrc element has two log categories, named libcamera-provider (for the video device provider) and libcamerasrc (for the operation of the camera). All corresponding debug messages can be enabled by setting the GST_DEBUG environment variable to libcamera*:7.

Presently, to prevent element negotiation failures it is required to specify the colorimetry and framerate as part of your pipeline construction. For instance, to capture and encode as a JPEG stream and receive on another device the following example could be used as a starting point:

gst-launch-1.0 libcamerasrc ! \
     video/x-raw,colorimetry=bt709,format=NV12,width=1280,height=720,framerate=30/1 ! \
     queue ! jpegenc ! multipartmux ! \
     tcpserversink host=0.0.0.0 port=5000

Which can be received on another device over the network with:

gst-launch-1.0 tcpclientsrc host=$DEVICE_IP port=5000 ! \
     multipartdemux ! jpegdec ! autovideosink

Troubleshooting

Several users have reported issues with meson installation, crux of the issue is a potential version mismatch between the version that root uses, and the version that the normal user uses. On calling ninja -C build, it can't find the build.ninja module. This is a snippet of the error message.

ninja: Entering directory `build'
ninja: error: loading 'build.ninja': No such file or directory

This can be solved in two ways:

  1. Don't install meson again if it is already installed system-wide.
  2. If a version of meson which is different from the system-wide version is already installed, uninstall that meson using pip3, and install again without the --user argument.

libcamera's People

Contributors

andrey-konovalov avatar christianrauch avatar davidplowman avatar devut avatar djrscally avatar ericcurtin avatar fsylvestre avatar harveychyang avatar helen-fornazier avatar initbasti avatar jhautbois avatar jmondi avatar jwrdegoede avatar kaairagupta avatar kbingham avatar mz-pdm avatar naushir avatar ndufresne avatar neg avatar nfraprado avatar njhollinghurst avatar pinchartl avatar pobrn avatar qschulz avatar rahi374 avatar ribalda avatar rothn avatar tomba avatar vedantparanjape avatar xroumegue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libcamera's Issues

Query on Pi Camera v3 CSI clock rates

I've been testing using a Pi Camera v3 for a high-altitude balloon application, where there is a GPS receive in proximity to the raspberry pi. I've previously used Pi Camera v2's with only minimal GPS interference issues, however now I'm testing a Pi Camera v3, I find that as soon as image capture starts, the GPS loses lock.

My suspicion is that the larger sensor size of the v3 results in higher CSI data lane rates, which may have harmonic issues at GPS L1 frequencies (1575 MHz).
How would I determine what CSI rates are in use? I'm capturing full-resolution stills.
Is there any way to force the CSI rate? Again, I'm only interested in capturing the occasional (every few second) still image, not high FPS video...

I've switched back and forth between the Pi Camera v2 and v3, and am fairly certain the issue is more prevalent on the v3 camera.

Building libcamera on the RPiv4 seems to crash the RPi

Not yet sure if this is a heat thing, a memory thing (this is a lower memory device) or because I have non-fully-tested firmwares loaded (from issue:1 here).

I can't attach a serial console at present so I can't easily see if there's a kernel panic. Just logging here for insight if anyone has any.

Next step will be reboot and get meson (ninja) to build only one job at a time.

Raspberry PI 4 B 8Gb + USB camera: gstreamer plugin doesn't work

Running Raspberry PI 4 B 8Gb with fresh and updated install of raspbian.

pi@raspberrypi:~/Workspaces/libcamera $ sudo apt-get update && sudo apt-get upgrade && sudo apt-get full-upgrade && sudo apt-get dist-upgrade
Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

pi@raspberrypi:~/Workspaces/libcamera $ sudo rpi-update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Your firmware is already up to date (delete /boot/.firmware_revision to force an update anyway)

pi@raspberrypi:~/Workspaces/libcamera $ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Installing and testing gstreamer which does work: the command line below runs as expected

pi@raspberrypi:~/Workspaces/libcamera $ gst-launch-1.0 videotestsrc ! ximagesink

Plugging USB camera (video0 and video1 - vlc enable to capture /dev/video0: the images are displayed by vlc as expected)

pi@raspberrypi:~/Workspaces/libcamera $ ll /dev/video*
crw-rw----+ 1 root video 81, 14 Jan  5 14:17 /dev/video0
crw-rw----+ 1 root video 81, 15 Jan  5 14:17 /dev/video1
crw-rw----+ 1 root video 81,  2 Jan  5 14:17 /dev/video10
crw-rw----+ 1 root video 81,  4 Jan  5 14:17 /dev/video11
crw-rw----+ 1 root video 81,  6 Jan  5 14:17 /dev/video12
crw-rw----+ 1 root video 81,  1 Jan  5 14:17 /dev/video13
crw-rw----+ 1 root video 81,  3 Jan  5 14:17 /dev/video14
crw-rw----+ 1 root video 81,  5 Jan  5 14:17 /dev/video15
crw-rw----+ 1 root video 81,  7 Jan  5 14:17 /dev/video16
crw-rw----+ 1 root video 81,  8 Jan  5 14:17 /dev/video18
crw-rw----+ 1 root video 81,  0 Jan  5 14:17 /dev/video19
crw-rw----+ 1 root video 81, 10 Jan  5 14:17 /dev/video20
crw-rw----+ 1 root video 81, 11 Jan  5 14:17 /dev/video21
crw-rw----+ 1 root video 81, 12 Jan  5 14:17 /dev/video22
crw-rw----+ 1 root video 81, 13 Jan  5 14:17 /dev/video23
crw-rw----+ 1 root video 81,  9 Jan  5 14:17 /dev/video31

Now, compiling from source https://github.com/raspberrypi/libcamera (with meson --prefix=/path/to/libcamera/local build),

pi@raspberrypi:~/Workspaces/libcamera $ gst-device-monitor-1.0 Video
Probing devices...

[0:57:37.249909054] [4654]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2+47-0684c373

Device found:

	name  : /base/scb/pcie@7d500000/pci@0,0/usb@0,0-1.1:1.0-0c45:6366
	class : Source/Video
	caps  : image/jpeg, width=160, height=120
	        image/jpeg, width=320, height=240
	        image/jpeg, width=640, height=480
	        image/jpeg, width=800, height=600
	        image/jpeg, width=1280, height=720
	        image/jpeg, width=1280, height=960
	        image/jpeg, width=1600, height=1200
	        video/x-raw, format=YUY2, width=800, height=600
	        video/x-raw, format=YUY2, width=1280, height=720
	        video/x-raw, format=YUY2, width=1600, height=1200
	gst-launch-1.0 libcamerasrc camera-name="/base/scb/pcie\@7d500000/pci\@0\,0/usb\@0\,0-1.1:1.0-0c45:6366" ! ...


pi@raspberrypi:~/Workspaces/libcamera $ GST_PLUGIN_PATH="/home/pi/Workspaces/libcamera/local/lib/aarch64-linux-gnu/gstreamer-1.0" gst-launch-1.0 libcamerasrc camera-name="/base/scb/pcie\@7d500000/pci\@0\,0/usb\@0\,0-1.1:1.0-0c45:6366" ! ximagesink
Setting pipeline to PAUSED ...
[0:58:03.345601554] [4658]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2+47-0684c373
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.
Additional debug info:
../src/gstreamer/gstlibcamerasrc.cpp(593): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.016944832
Setting pipeline to NULL ...
Freeing pipeline ...

Looks like gst-launch-1.0 libcamerasrc does not work with USB camera?!... Is this expected or what did I miss?

I am trying to understand if the compiled-from-source libcamera can get live images from USB cameras on Raspberry PI 4 B 8Gb: is this supported?

Note: cam seems to run.

pi@raspberrypi:~/Workspaces/libcamera $ ./local/bin/cam --list
[1:00:45.891999956] [4669]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2+47-0684c373
Available cameras:
1: 'Arducam OV2311 USB Camera: Ardu' (/base/scb/pcie@7d500000/pci@0,0/usb@0,0-1.1:1.0-0c45:6366)


pi@raspberrypi:~/Workspaces/libcamera $ ./local/bin/cam --camera 1 --capture --file
[1:01:33.762594353] [4674]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2+47-0684c373
Using camera /base/scb/pcie@7d500000/pci@0,0/usb@0,0-1.1:1.0-0c45:6366 as cam0
[1:01:33.921108221] [4674]  INFO Camera camera.cpp:1026 configuring streams: (0) 1600x1200-MJPEG
cam0: Capture until user interrupts by SIGINT
3694.555635 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 49784
3694.727667 (5.81 fps) cam0-stream0 seq: 000001 bytesused: 49880
3694.759673 (31.24 fps) cam0-stream0 seq: 000002 bytesused: 50712
^CExiting

Some frame-cam0*.bin are generated and can be opened with gimp: so reading live images seems to work using cam but not using gstreamer nor libcamera-hello (see next note)

Note: first, I tried to build from source libcamera-apps but get

pi@raspberrypi:~/Workspaces/libcamera-apps $ ./local/bin/libcamera-hello 
libEGL warning: DRI2: failed to authenticate
Made X/EGL preview window
[1:06:53.916145384] [4689]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2+47-0684c373
ERROR: *** no cameras available ***

Narrowing down the problem, I realized that gstreamer plugin from libcamera didn't work and that I was not sure if cam from libcamera was able to fetch live images from USB camera.

no element 'libcamerasrc'

I'm running Ubuntu 22.04 and have successfully built libcamera and libcamera-apps from source. Both work flawlessly, except I'm unable to use gstreamer, which appears to be impacting my ability to use open-cv as well. The error I get whenever I run any variation of: gst-launch-1.0 libcamerasrc

Is: WARNING: erroneous pipeline: no element "libcamerasrc"

I confirmed in the meson build report that gstreamer was successfully recognized.

Rotate 90 Deg

is there any way to rotate Pi Camera Module 2 NoIR to 90 Deg it's just only rotate 0 & 180 Deg

Linking error during building for armv6l (RPi 1)

Hi,
Since this library is missing in Void linux, I'm trying to package it. It builds for all supported platforms (arm64, armv7) including the musl variants, except for armv6l. Is there anything special with RPi 1 and armv6l which I need to consider? Thank you. The error message follows.

arm-linux-gnueabihf-c++  -o src/libcamera/libcamera.so.0.0.4 src/libcamera/libcamera.so.0.0.4.p/meson-generated_.._proxy_raspberrypi_ipa_proxy.cpp.o src/libcamera/libcamera.so.0.0.4.p/meson-generated_.._proxy_rkisp1_ipa_proxy.cpp.o src/libcamera/libcamera.so.0.0.4.p/meson-generated_.._control_ids.cpp.o src/libcamera/libcamera.so.0.0.4.p/meson-generated_.._property_ids.cpp.o src/libcamera/libcamera.so.0.0.4.p/meson-generated_.._version.cpp.o src/libcamera/libcamera.so.0.0.4.p/meson-generated_.._ipa_pub_key.cpp.o src/libcamera/libcamera.so.0.0.4.p/bayer_format.cpp.o src/libcamera/libcamera.so.0.0.4.p/byte_stream_buffer.cpp.o src/libcamera/libcamera.so.0.0.4.p/camera.cpp.o src/libcamera/libcamera.so.0.0.4.p/camera_controls.cpp.o src/libcamera/libcamera.so.0.0.4.p/camera_lens.cpp.o src/libcamera/libcamera.so.0.0.4.p/camera_manager.cpp.o src/libcamera/libcamera.so.0.0.4.p/camera_sensor.cpp.o src/libcamera/libcamera.so.0.0.4.p/camera_sensor_properties.cpp.o src/libcamera/libcamera.so.0.0.4.p/color_space.cpp.o src/libcamera/libcamera.so.0.0.4.p/controls.cpp.o src/libcamera/libcamera.so.0.0.4.p/control_serializer.cpp.o src/libcamera/libcamera.so.0.0.4.p/control_validator.cpp.o src/libcamera/libcamera.so.0.0.4.p/converter.cpp.o src/libcamera/libcamera.so.0.0.4.p/delayed_controls.cpp.o src/libcamera/libcamera.so.0.0.4.p/device_enumerator.cpp.o src/libcamera/libcamera.so.0.0.4.p/device_enumerator_sysfs.cpp.o src/libcamera/libcamera.so.0.0.4.p/fence.cpp.o src/libcamera/libcamera.so.0.0.4.p/formats.cpp.o src/libcamera/libcamera.so.0.0.4.p/framebuffer.cpp.o src/libcamera/libcamera.so.0.0.4.p/framebuffer_allocator.cpp.o src/libcamera/libcamera.so.0.0.4.p/geometry.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipa_controls.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipa_data_serializer.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipa_interface.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipa_manager.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipa_module.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipa_proxy.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipc_pipe.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipc_pipe_unixsocket.cpp.o src/libcamera/libcamera.so.0.0.4.p/ipc_unixsocket.cpp.o src/libcamera/libcamera.so.0.0.4.p/mapped_framebuffer.cpp.o src/libcamera/libcamera.so.0.0.4.p/media_device.cpp.o src/libcamera/libcamera.so.0.0.4.p/media_object.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_handler.cpp.o src/libcamera/libcamera.so.0.0.4.p/pixel_format.cpp.o src/libcamera/libcamera.so.0.0.4.p/process.cpp.o src/libcamera/libcamera.so.0.0.4.p/pub_key.cpp.o src/libcamera/libcamera.so.0.0.4.p/request.cpp.o src/libcamera/libcamera.so.0.0.4.p/source_paths.cpp.o src/libcamera/libcamera.so.0.0.4.p/stream.cpp.o src/libcamera/libcamera.so.0.0.4.p/sysfs.cpp.o src/libcamera/libcamera.so.0.0.4.p/transform.cpp.o src/libcamera/libcamera.so.0.0.4.p/v4l2_device.cpp.o src/libcamera/libcamera.so.0.0.4.p/v4l2_pixelformat.cpp.o src/libcamera/libcamera.so.0.0.4.p/v4l2_subdevice.cpp.o src/libcamera/libcamera.so.0.0.4.p/v4l2_videodevice.cpp.o src/libcamera/libcamera.so.0.0.4.p/yaml_parser.cpp.o src/libcamera/libcamera.so.0.0.4.p/converter_converter_v4l2_m2m.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_imx8-isi_imx8-isi.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_raspberrypi_delayed_controls.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_raspberrypi_dma_heaps.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_raspberrypi_raspberrypi.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_raspberrypi_rpi_stream.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_rkisp1_rkisp1.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_rkisp1_rkisp1_path.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_simple_simple.cpp.o src/libcamera/libcamera.so.0.0.4.p/pipeline_uvcvideo_uvcvideo.cpp.o -L/usr/arm-linux-gnueabihf/usr/lib -flto -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libcamera.so.0.0.4 -Wno-psabi -Wshadow -include /builddir/rpi-libcamera-20230303/build/config.h -Wl,-z,relro -Wl,-z,now -Wl,--as-needed '-Wl,-rpath,$ORIGIN/base:/usr/arm-linux-gnueabihf/usr/lib32:/' -Wl,-rpath-link,/builddir/rpi-libcamera-20230303/build/src/libcamera/base -Wl,-rpath-link,/usr/arm-linux-gnueabihf/usr/lib32 src/libcamera/base/libcamera-base.so.0.0.4 /usr/arm-linux-gnueabihf/usr/lib32/libgnutls.so /usr/arm-linux-gnueabihf/usr/lib/libyaml.so -Wl,--end-group
/usr/lib/gcc/arm-linux-gnueabihf/12.2.0/../../../../arm-linux-gnueabihf/bin/ld: /tmp/ccmihFB1.ltrans9.ltrans.o: in function `libcamera::V4L2BufferCache::V4L2BufferCache(std::vector<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> >, std::allocator<std::unique_ptr<libcamera::FrameBuffer, std::default_delete<libcamera::FrameBuffer> > > > const&)':
<artificial>:(.text+0x2da0): undefined reference to `__atomic_fetch_add_8'
/usr/lib/gcc/arm-linux-gnueabihf/12.2.0/../../../../arm-linux-gnueabihf/bin/ld: /tmp/ccmihFB1.ltrans9.ltrans.o: in function `libcamera::V4L2BufferCache::get(libcamera::FrameBuffer const&)':
<artificial>:(.text+0x30c8): undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
[161/182] Compiling C++ object src/ipa/rkisp1/ipa_rkisp1.so.p/algorithms_gsl.cpp.o
[162/182] Compiling C++ object src/ipa/rkisp1/ipa_rkisp1.so.p/rkisp1.cpp.o
[163/182] Compiling C++ object src/apps/common/libapps.a.p/image.cpp.o
[164/182] Compiling C++ object src/ipa/rkisp1/ipa_rkisp1.so.p/algorithms_filter.cpp.o
[165/182] Compiling C++ object src/ipa/rkisp1/ipa_rkisp1.so.p/algorithms_lsc.cpp.o
[166/182] Compiling C++ object src/apps/common/libapps.a.p/stream_options.cpp.o
[167/182] Compiling C++ object src/apps/common/libapps.a.p/options.cpp.o
ninja: build stopped: subcommand failed.

ctt tool unable to read exif tags

ctt tool is unable to read exif tags from raw image created using libcamera-still -o filename.dng...

Traceback (most recent call last):
  File "/home/dkt/.local/lib/python3.9/site-packages/pyexiv2/metadata.py", line 195, in _get_exif_tag
    return self._tags['exif'][key]
KeyError: 'Exif.SubImage1.ImageWidth'

libcamera version...

$ apt info libcamera0
Package: libcamera0
Version: 0~git20230302+923f5d70-1

libcamera-apps version...

$ apt info libcamera-apps
Package: libcamera-apps
Version: 0~git20230301+54a781d-1

Documentation claims this can be built with Meson 0.56, but 0.58 is required

Hello! 👋

Currently, your fork of libcamera advertises itself as only requiring Meson 0.56. However, this is not actually the case as your meson.build uses the replace() function for strings, which was introduced in Meson 0.58: https://mesonbuild.com/Release-notes-for-0-58-0.html#string-replace

To resolve this you can cherry-pick this commit from upstream: https://git.libcamera.org/libcamera/libcamera.git/commit/meson.build?id=02518e598e8f057b76a08940e1bc8a99d879fad6

Or just rebase.

Libcamera - proper 60fps support missing for rpi HQ camera

Our goal is to use use both 1280x720@60 and 640x480@90 fps modes on the rpi default HQ camera with libcamera.

720p60 and 640x480@90 both work flawlessly in the mmal land (we use gst-rpicamsrc for that, but that is just the same as using hello-video or similar).

However, I kinda get the feeling that these 2 modes are still missing in libcamera, or at least not implemented as well as in mmal.

Example 1)
Running libcamera-hello with at 720p60:

sudo libcamera-hello --width 1280 --height 720 --framerate 60 Made DRM preview window [0:17:28.096152832] [8914] INFO Camera camera_manager.cpp:293 libcamera v0.0.1+21-7c855784 [0:17:28.124998782] [8915] INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0 [0:17:28.125688685] [8914] INFO Camera camera.cpp:1026 configuring streams: (0) 2028x1140-YUV420 [0:17:28.126073275] [8915] INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-pBCC
it shows me that the actual sensor format selected is 2028x1080, and there is no way for the rpi ISP to handle that much data at 60fps. Or the data is cropped before going through the ISP, but that is a much worse solution than mmal had.

Same for 640x480@90:
sudo libcamera-hello --width 640 --height 480 --framerate 90 Made DRM preview window [0:20:57.802223521] [8949] INFO Camera camera_manager.cpp:293 libcamera v0.0.1+21-7c855784 [0:20:57.830808341] [8950] INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0 [0:20:57.831491227] [8949] INFO Camera camera.cpp:1026 configuring streams: (0) 2026x1520-YUV420 [0:20:57.831845004] [8950] INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC

I can also observe that when running a gstreamer pipeline with either 720p or 640x480, the output framerate(s) never exceed 30fps.
Example pipeline:

libcamerasrc camera-name=/base/soc/i2c0mux/i2c@1/imx477@1a ! capsfilter caps=video/x-raw,width=1280,height=720,format=NV12,framerate=60/1 ! v4l2convert ! v4l2h264enc extra-controls="controls,repeat_sequence_header=1,h264_profile=1,h264_level=11,video_bitrate=5000000,h264_i_frame_period=30,h264_minimum_qp_value=10" ! video/x-h264,level=(string)4 ! queue ! h264parse config-interval=-1 ! rtph264pay mtu=1024 ! udpsink host=127.0.0.1 port=5600

and the log also shows me
INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-pBCC

Am I correct that 720p60 and 640x480@90 has never been properly implemented in libcamera on the rpi, and therefore is still only available from the mmal land ?

installation guide that works

I accidentally updated my pi to bullseye and thought, why not try the new libcamera instead of turning legacy back on that now says it's being depricated.

before all I had to do to code in python, which is the raspberry pi's go to language:

apt install ffmpeg
create virtual environment (because that's how python should be done)
pip install ffmpeg-python
(other packages exist to do similar things like open-cv, but this was from my experience the easiest and most pythonic package)

and then I have everything usable in python for whatever I want to do.

Now I've spent a full day trying to figure out how to get basic "record a video" functionallity up and running.
You've made something simple into someting seemingly impossible and made it feel very much not like raspberry pi.

  • libcamera can't be installed or used from a virtual environment
  • picamera2 can't be installed with pip without first installing strange python libraries and then it cant be used in a virutal environment because it libcamera is not installed there.

This "upgrade" is a hot mess and I hope this will be something usable in the future, but for now I'm going back to legacy as basically every guide on the internet says to do instead of trying to use libcamera.

JPEG support

QCam or sample application needs to take a stream and write out JPG data files.

>>> - JPEG support would be nice.
>>
>> I presume you mean allowing qcam to write a captured image out to a jpeg
>> file here?
>>
>
> Yes, perhaps just a "capture" button on the UI that does this?

Ok, perhaps time to dig up and revive my toolbar patches.

I expect we should be able to use QT to save to JPEG quite easily.

Gain oscillations

Running on RPi4, with IMX219. And I what I believe to be the latest code, (I.e. assumed to be what you were running last week).

Actually this is probably both gain and exposure oscillations. But the visual effect is clear.

Here's a log file, and if anyone would like to see the visuals, let me know and I can do a hangout video call with the RPi HDMI output as my video source.

Alternatively I could do a screen record and upload or e-mail if you wish.

qcam-oscillations.txt

libcamera-vid not showing video

libcamera-vid does not show video, except when used with the --qt-preview argument - then everything is OK.
tested with latest master.
with a checkout from April, this was still working fine.

Issue with gstreamer plugin and IMX519 higher resolutions

I have an Arducam IMX519 camera on a Raspberry Pi 4, which seems to work fine with libcamera apps (libcamera-still), but fails on high resolutions with gstreamer plugin (libcamerasrc).

The following configuration works fine:

# I can see output in window
gst-launch-1.0 libcamerasrc ! 'video/x-raw,width=3840,height=2400,framerate=5/1' ! glimagesink
# Can also record to a file
gst-launch-1.0 libcamerasrc ! 'video/x-raw,width=3840,height=2400,framerate=5/1' ! jpegenc ! avimux ! filesink location=mjpeg.avi

However, when I increase resolution to a maximum of 4656x3496, this is what I get in glimagesink:

glimagesink

I can see pixels change when I move the camera, so it seems to be a buffer size/alignment/format problem.

What I found interesting is that all predefined resolutions work correctly, except for the [min, max, step] format, under which 4656x3496 falls. Here is output from gst-device-monitor-1.0 Video command:

pi@raspberrypi:~ $ gst-device-monitor-1.0 Video
Probing devices...

[125:22:23.295294941] [41496]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3701-f30ad033-dirty (2022-08-16T13:56:54+01:00)
[125:22:23.315788975] [41498]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'imx519'
[125:22:23.315863214] [41498]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[125:22:23.438486087] [41498]  INFO RPI raspberrypi.cpp:1368 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media3 and ISP device /dev/media0

Device found:

        name  : /base/soc/i2c0mux/i2c@1/imx519@1a
        class : Source/Video
        caps  : video/x-raw, format=NV21, width=160, height=120
                video/x-raw, format=NV21, width=240, height=160
                video/x-raw, format=NV21, width=320, height=240
                video/x-raw, format=NV21, width=400, height=240
                video/x-raw, format=NV21, width=480, height=320
                video/x-raw, format=NV21, width=640, height=360
                video/x-raw, format=NV21, width=640, height=480
                video/x-raw, format=NV21, width=720, height=480
                video/x-raw, format=NV21, width=768, height=480
                video/x-raw, format=NV21, width=854, height=480
                video/x-raw, format=NV21, width=720, height=576
                video/x-raw, format=NV21, width=800, height=600
                video/x-raw, format=NV21, width=960, height=540
                video/x-raw, format=NV21, width=1024, height=576
                video/x-raw, format=NV21, width=960, height=640
                video/x-raw, format=NV21, width=1024, height=600
                video/x-raw, format=NV21, width=1024, height=768
                video/x-raw, format=NV21, width=1280, height=720
                video/x-raw, format=NV21, width=1152, height=864
                video/x-raw, format=NV21, width=1280, height=800
                video/x-raw, format=NV21, width=1360, height=768
                video/x-raw, format=NV21, width=1366, height=768
                video/x-raw, format=NV21, width=1440, height=900
                video/x-raw, format=NV21, width=1280, height=1024
                video/x-raw, format=NV21, width=1536, height=864
                video/x-raw, format=NV21, width=1280, height=1080
                video/x-raw, format=NV21, width=1600, height=900
                video/x-raw, format=NV21, width=1400, height=1050
                video/x-raw, format=NV21, width=1680, height=1050
                video/x-raw, format=NV21, width=1600, height=1200
                video/x-raw, format=NV21, width=1920, height=1080
                video/x-raw, format=NV21, width=2048, height=1080
                video/x-raw, format=NV21, width=1920, height=1200
                video/x-raw, format=NV21, width=2160, height=1080
                video/x-raw, format=NV21, width=2048, height=1152
                video/x-raw, format=NV21, width=2560, height=1080
                video/x-raw, format=NV21, width=2048, height=1536
                video/x-raw, format=NV21, width=2560, height=1440
                video/x-raw, format=NV21, width=2560, height=1600
                video/x-raw, format=NV21, width=3840, height=1080
                video/x-raw, format=NV21, width=2960, height=1440
                video/x-raw, format=NV21, width=3440, height=1440
                video/x-raw, format=NV21, width=2560, height=2048
                video/x-raw, format=NV21, width=3200, height=1800
                video/x-raw, format=NV21, width=3840, height=1600
                video/x-raw, format=NV21, width=3200, height=2048
                video/x-raw, format=NV21, width=3200, height=2400
                video/x-raw, format=NV21, width=3840, height=2160
                video/x-raw, format=NV21, width=4096, height=2160
                video/x-raw, format=NV21, width=3840, height=2400
                video/x-raw, format=NV21, width=[ 64, 4656, 2 ], height=[ 64, 3496, 2 ]
                video/x-raw, format=I420, width=160, height=120
                video/x-raw, format=I420, width=240, height=160
                video/x-raw, format=I420, width=320, height=240
                video/x-raw, format=I420, width=400, height=240
                video/x-raw, format=I420, width=480, height=320
                video/x-raw, format=I420, width=640, height=360
                video/x-raw, format=I420, width=640, height=480
                video/x-raw, format=I420, width=720, height=480
                video/x-raw, format=I420, width=768, height=480
                ***TRUNCATED***

I tried libcamera from Arducam binary distribution and compiling from git source, but the issue persists on both.

I'm not too familiar with libcamera stack, but I could try help debugging this if given some hints where to look.

After update libcamera Cannot allocate memory

Hi,

I am using RPi 3B and had a running script using picamera2. However, after the update of picamera2, I had to update the system, and now, I cannot use the Pi HQ camera on Pi3B, but the problem seems to be related to libcamera itself, not picamera2. The error I am getting is:

pi@raspberrypi:~ $ libcamera-jpeg -o test.jpg --nopreview
[0:00:31.443247607] [1056]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3866-0c55e522
[0:00:31.588132350] [1057]  INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:00:31.590505922] [1056]  INFO Camera camera.cpp:1035 configuring streams: (0) 2028x1520-YUV420
[0:00:31.591771616] [1057]  INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC
[0:00:37.311628603] [1056]  INFO Camera camera.cpp:1035 configuring streams: (0) 4056x3040-YUV420 (1) 4056x3040-SBGGR12_CSI2P
[0:00:37.314459826] [1057]  INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 4056x3040-SBGGR12_1X12 - Selected unicam format: 4056x3040-pBCC
[0:00:37.318026212] [1057] ERROR V4L2 v4l2_videodevice.cpp:1234 /dev/video14[15:cap]: Unable to request 1 buffers: Cannot allocate memory
ERROR: *** failed to allocate capture buffers ***

I tried RPi camera 1.3, and it works well. The details of my system:
Linux raspberrypi 5.15.61-v7+ #1579 SMP Fri Aug 26 11:10:59 BST 2022 armv7l GNU/Linux

I have activated KMS GL driver and glamor.

My boot.txt:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
#dtoverlay=imx477 (does not work)
#dtoverlay=vc4-fkms-v3d (does not work)
#max_framebuffers=2 (also does not work)

# Disable compensation for displays with overscan
disable_overscan=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[all]

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
dtparam=act_led_trigger=actpwr
#gpu_mem=76
disable_camera_led=1

If someone could guide me and show me how to fix that issue, that would be great.
Thanks,
Dawid

libcamera module compilation for Python version 3.11

Is libcamera compatible with Python 3.11 ?

The Python version 3.11 is installed on a Raspberry (Bullseye) with altinstall flag, so, both Python 3.9 and 3.11 works together.

I can create virtual env, install picamera2 from pip (pip3.11), everything is ok, but:

Python 3.11.2 (main, Mar 16 2023, 15:19:49) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import picamera2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/env311/lib/python3.11/site-packages/picamera2/__init__.py", line 1, in <module>
    import libcamera
ModuleNotFoundError: No module named 'libcamera'

The error is normal, and it is the subject of my question: how can I compile libcamera for a specific Python version, 3.11 in this case ?

Thx

imx219 Rev.D instable behavior, init fails

Describe the bug
imx219 Rev.C (UC-350) working fine on raspberry4 64bit with libcamera interface
imx219 Rev.D (UC-350) not working with various issues with libcamera interface

Bug report
bug-report.txt

Additional context
Some imx219 Rev.D can run as secondary camera on multi camera boards. Several have issues on initialization with a direct connection to raspberry. It is unclear why there is variation in behavior, the Rev.D camera have been ordered in one batch from the producer.

dmesg log is shown regardless if camera imx219 C or D is connected on boot:
[ 7.055467] imx219 10-0010: Consider updating driver imx219 to match on endpoints

Updating OS, eeprom, rpi-update did not help.

Swapping (replugging) between RevC and RevD cameras is possible. It leads to same behavior.
RevC working init, RevD error stuck in init.

Camera connected, but not available in libcamera on RPi4B running Ubuntu 22.04

Not sure if I posted this in the right spot originally (libcamera-org/libcamera). Posting here as well. Will close whichever gets assigned or makes progress.

Just got libcamera working on an RPi4B running Ubuntu 22.04 LTS, but "cam -l" does not list a camera available. (Confirmed the camera and hardware work with RPi OS and libcamera-hello prior to the build.)
From preliminary troubleshooting suspect it has something to do with permissions.

The initial error codes indicate libcamera (or the OS) recognized the camera (imx477), but had problems with dmaHeap.
"ERROR RPI dma_heaps.cpp:53 Could not open any dmaHeap device", and
"ERROR RPI raspberrypi.cpp:1278 Failed to register camera imx477 10-001a: -12"

From reading about dmaHeap issues online I added my username to the 'video' group and no longer get those errors, but still no camera is available. Not sure what to make of the debug output below, other than things generally look good (no errors).

Any recommendations on what else to look into?

luis@RPi4-Ubuntu:~$ LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l
[0:10:29.031297600] [3202] DEBUG IPAModule ipa_module.cpp:329 ipa_rkisp1.so: IPA module /usr/local/lib/aarch64-linux-gnu/libcamera/ipa_rkisp1.so is signed
[0:10:29.031920457] [3202] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/local/lib/aarch64-linux-gnu/libcamera/ipa_rkisp1.so'
[0:10:29.033633179] [3202] DEBUG IPAModule ipa_module.cpp:329 ipa_rpi.so: IPA module /usr/local/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so is signed
[0:10:29.034040170] [3202] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/local/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so'
[0:10:29.034515567] [3202]  INFO Camera camera_manager.cpp:299 libcamera v0.0.4+17-3f8bcc1a
[0:10:29.034992705] [3205] DEBUG Camera camera_manager.cpp:108 Starting camera manager
[0:10:29.052254924] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-codec" created from /dev/media2
[0:10:29.052679674] [3205] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media2 due to 5 missing dependencies
[0:10:29.058059409] [3205] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media2 found
[0:10:29.058322440] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media2: bcm2835-codec
[0:10:29.060125198] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-isp" created from /dev/media0
[0:10:29.060326675] [3205] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media0 due to 4 missing dependencies
[0:10:29.061321116] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-isp" created from /dev/media3
[0:10:29.061479539] [3205] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media3 due to 4 missing dependencies
[0:10:29.065747705] [3205] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media0 found
[0:10:29.065879906] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media0: bcm2835-isp
[0:10:29.069546567] [3205] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media3 found
[0:10:29.069689675] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media3: bcm2835-isp
[0:10:29.070569564] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "unicam" created from /dev/media1
[0:10:29.071008221] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media1: unicam
[0:10:29.072645574] [3205] DEBUG Camera camera_manager.cpp:151 Found registered pipeline handler 'PipelineHandlerISI'
[0:10:29.073274987] [3205] DEBUG Camera camera_manager.cpp:151 Found registered pipeline handler 'PipelineHandlerRPi'
[0:10:29.073481056] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "unicam"
[0:10:29.073627035] [3205] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "bcm2835-isp"
[0:10:29.073813771] [3205] DEBUG Camera camera_manager.cpp:151 Found registered pipeline handler 'PipelineHandlerRkISP1'
[0:10:29.074557088] [3205] DEBUG Camera camera_manager.cpp:151 Found registered pipeline handler 'SimplePipelineHandler'
[0:10:29.074890711] [3205] DEBUG Camera camera_manager.cpp:151 Found registered pipeline handler 'PipelineHandlerUVC'
Available cameras:
luis@RPi4-Ubuntu:~$ 

Cam utility is not listing the camera in RPI 3B+

Hi

In RDK-C RPI camera image, Added "dtoverlay=imx219" in /boot/config.txt file and rebooted the system.

Once system rebooted , tried to list out available camera in RPI system with 'cam -l' utility.

But it is not listing the camera. After the some prints binary is hanged.

Used latest libcamera revision : 74ab3f7

Please find below log:
root@raspberrypi3-rdk-camera:/# LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l
[0:07:24.203442902] [2744] DEBUG IPAModule ipa_module.cpp:329 ipa_ipu3.so: IPA module /usr/lib/libcamera/ipa_ipu3.so is signed
[0:07:24.204257225] [2744] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/libcamera/ipa_ipu3.so'
[0:07:24.204645246] [2744] DEBUG IPAModule ipa_module.cpp:329 ipa_rkisp1.so: IPA module /usr/lib/libcamera/ipa_rkisp1.so is signed
[0:07:24.204989882] [2744] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/libcamera/ipa_rkisp1.so'
[0:07:24.205391288] [2744] DEBUG IPAModule ipa_module.cpp:329 ipa_rpi.so: IPA module /usr/lib/libcamera/ipa_rpi.so is signed
[0:07:24.205846496] [2744] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/libcamera/ipa_rpi.so'
[0:07:24.206135559] [2744] DEBUG IPAModule ipa_module.cpp:329 ipa_vimc.so: IPA module /usr/lib/libcamera/ipa_vimc.so is signed
[0:07:24.206385871] [2744] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/libcamera/ipa_vimc.so'
[0:07:24.206666548] [2744] INFO Camera camera_manager.cpp:293 libcamera v0.0.0
[0:07:24.207170871] [2745] DEBUG Camera camera_manager.cpp:106 Starting camera manager
[0:07:24.221253736] [2745] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-codec" created from /dev/media2
[0:07:24.221469413] [2745] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media2 due to 3 missing dependencies
[0:07:24.225524621] [2745] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media2 found
[0:07:24.225669829] [2745] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media2: bcm2835-codec

Binary is hanged after this print.

#################################################################################################

But able to list out camera in RPI system with oldest libcamera revision

Used libcamera revision : 58d487b (30Oct2020)

Working log:
Working_old_libcamera_log.txt

How should a high-quality still stream and a fast video-stream work together?

Hiya!

Thanks for creating this amazingly well written package!

I'm working on a usecase where we want to capture a video and capture a still at somewhere during the video. The video should have a decent fps, and the still should be of reasonable quality. I understand that these two requirements don't go well together, but I do need to work my way around it best as I can.

I want to know what the recommended solution in cases like this is. I can think of the following general strategies, but I don't know what will work best.

  • Stop the camera, clear all associated resources, load a new configuration, and start it again from scratch.
    • This approach is taken by the libcamera-still app from libcamera-apps. But it takes roughly 0.5 seconds and in those seconds there are no frames recorded for the video.
  • Stop the camera, not clear all the resources, load the new configuration, and do a warm start.
    • I've tried this, but could not get it to work yet. I dont understand if I can keep the Stream, Request, FrameBuffer and Allocator objects or not.
  • Use a single stream and update the configuration while the camera is running. I don't think this is possible because the Camera needs to be in the Acquired or Configured state to be able to configure it again.
  • Temporary disable a stream. I don't think this can be done, but happy to be surprised :)
  • Do a Request for a subset of the configured streams. I don't know if this is at all possible.

Plenty of ideas, but I don't have a clue on what is the recommend approach. Happy to add more detail if needed.

A bit more context: I'm using the libcamera-apps as a start, and adjusting it to suit my needs. That's why I asked the question here and not in the libcamera-apps project. Sorry if I mixed up the lingo a bit.

Stopping and restarting the stream fails

When stopping the stream, and restarting the stream does not successfully resume.

This can be tested with the new QCam toolbar additions.
A stop/start button is provided which halts the stream, and then restarts it.

The same methods are used when switching between cameras (for instance if a second UVC camera is attached) where the following will fail:

  • Start streaming on imx219
  • Switch streaming to UVC camera
  • Switch streaming to imx219
    *** Pipeline fails

Switching to camera imx219 0-0010
[0:04:02.092516103] [1054] INFO Camera camera.cpp:750 configuring streams: (0) 800x600-0x34324152
[0:04:02.113441286] [1054] ERR V4L2 v4l2_videodevice.cpp:983 /dev/video15[cap]: Buffers already allocated
[0:04:02.113587255] [1054] ERR RPI raspberrypi.cpp:461 Failed to export ISP Output 1 buffers
[0:04:02.113966026] [1054] ERR RPI raspberrypi.cpp:589 Failed to allocate buffers
Failed to start capture

IPC/IPA error while running gst-launch pipeline

Hi,
I have attached Rpi-Hq-Camera to R.Pi4 board running Ubuntu 22.04.1.
The dmesg shows this

[    8.007776] imx477 10-001a: Device found is imx477
[    8.008300] imx477 10-001a: Consider updating driver imx477 to match on endpoints

And When I try to run a gst-launch pipeline to view the data from libcamerasrc I get this error

->gst-launch-1.0 libcamerasrc ! videoscale ! videoconvert ! ximagesinkSetting pipeline to PAUSED ...
[0:03:13.831499342] [6843]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2
[0:03:13.885655931] [6845]  INFO RPI raspberrypi.cpp:1386 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media1 and ISP device /dev/media2
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[0:03:14.105665133] [6849]  INFO Camera camera.cpp:1026 configuring streams: (0) 1280x1080-XRGB8888
[0:03:14.106529363] [6845]  INFO RPI raspberrypi.cpp:766 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC
[0:03:16.169349543] [6845] ERROR IPCPipe ipc_pipe_unixsocket.cpp:134 Call timeout!
[0:03:16.169469521] [6845] ERROR IPCPipe ipc_pipe_unixsocket.cpp:66 Failed to call sync
[0:03:16.169521334] [6845] ERROR IPAProxy raspberrypi_ipa_proxy.cpp:238 Failed to call start
[0:03:16.841559096] [6845] ERROR IPCUnixSocket ipc_unixsocket.cpp:191 Failed to send: Connection refused
[0:03:16.841782348] [6845] ERROR IPCPipe ipc_pipe_unixsocket.cpp:80 Failed to call async
[0:03:16.841884844] [6845] ERROR IPAProxy raspberrypi_ipa_proxy.cpp:555 Failed to call signalQueueRequest
[0:03:16.842072116] [6845] ERROR IPCUnixSocket ipc_unixsocket.cpp:191 Failed to send: Transport endpoint is not connected
[0:03:16.842175446] [6845] ERROR IPCPipe ipc_pipe_unixsocket.cpp:80 Failed to call async
[0:03:16.842252406] [6845] ERROR IPAProxy raspberrypi_ipa_proxy.cpp:593 Failed to call signalIspPrepare

At this point the pipeline is fully stalled and I do a Ctrl+C to end it.

Can you suggest what may be causing the above IPC/IPA errors.

Does not Build with Clang on rpi

Hello! I have been working to build the picamera2 branch, and I wanted to report that it does not seem happy building with clang in the current state.

pi@raspberrypi:~/libcamera $ ninja -C build -j 1
ninja: Entering directory `build'
[16/141] Generating ipa-priv-key with a custom command
.........................................................+++++
....................+++++
[42/141] Generating ipa_pub_key_cpp with a custom command
writing RSA key
[132/141] Compiling C++ object src/py/libcamera/_libcamera.so.p/pymain.cpp.o
FAILED: src/py/libcamera/_libcamera.so.p/pymain.cpp.o 
clang++ -Isrc/py/libcamera/_libcamera.so.p -Isrc/py/libcamera -I../src/py/libcamera -Iinclude -I../include -I../subprojects/pybind11-2.6.1/include -Iinclude/libcamera -I/usr/include/python3.9 -I/usr/include/arm-linux-gnueabihf/python3.9 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -g -Wextra-semi -Wthread-safety -Wshadow -include config.h -Wno-c99-designator -fPIC -fvisibility=hidden -Wno-shadow -MD -MQ src/py/libcamera/_libcamera.so.p/pymain.cpp.o -MF src/py/libcamera/_libcamera.so.p/pymain.cpp.o.d -o src/py/libcamera/_libcamera.so.p/pymain.cpp.o -c ../src/py/libcamera/pymain.cpp
In file included from ../src/py/libcamera/pymain.cpp:18:
In file included from ../subprojects/pybind11-2.6.1/include/pybind11/functional.h:12:
In file included from ../subprojects/pybind11-2.6.1/include/pybind11/pybind11.h:45:
In file included from ../subprojects/pybind11-2.6.1/include/pybind11/attr.h:13:
In file included from ../subprojects/pybind11-2.6.1/include/pybind11/cast.h:13:
In file included from ../subprojects/pybind11-2.6.1/include/pybind11/pytypes.h:12:
../subprojects/pybind11-2.6.1/include/pybind11/detail/common.h:771:38: error: extra ';' after member function definition [-Werror,-Wextra-semi]
    constexpr overload_cast_impl() {}; // NOLINT(modernize-use-equals-default):  MSVC 2015 needs this
                                     ^
../src/py/libcamera/pymain.cpp:38:10: error: local variable 't' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
                return t;
                       ^
../src/py/libcamera/pymain.cpp:38:10: note: call 'std::move' explicitly to avoid copying
                return t;
                       ^
                       std::move(t)
../src/py/libcamera/pymain.cpp:38:10: error: local variable 't' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
                return t;
                       ^
../src/py/libcamera/pymain.cpp:48:10: note: in instantiation of function template specialization 'ValueOrTuple<bool>' requested here
                return ValueOrTuple<bool>(cv);
                       ^
../src/py/libcamera/pymain.cpp:38:10: note: call 'std::move' explicitly to avoid copying
                return t;
                       ^
                       std::move(t)
../src/py/libcamera/pymain.cpp:38:10: error: local variable 't' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
                return t;
                       ^
../src/py/libcamera/pymain.cpp:50:10: note: in instantiation of function template specialization 'ValueOrTuple<unsigned char>' requested here
                return ValueOrTuple<uint8_t>(cv);
                       ^
../src/py/libcamera/pymain.cpp:38:10: note: call 'std::move' explicitly to avoid copying
                return t;
                       ^
                       std::move(t)
../src/py/libcamera/pymain.cpp:38:10: error: local variable 't' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
                return t;
                       ^
../src/py/libcamera/pymain.cpp:52:10: note: in instantiation of function template specialization 'ValueOrTuple<int>' requested here
                return ValueOrTuple<int32_t>(cv);
                       ^
../src/py/libcamera/pymain.cpp:38:10: note: call 'std::move' explicitly to avoid copying
                return t;
                       ^
                       std::move(t)
../src/py/libcamera/pymain.cpp:38:10: error: local variable 't' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
                return t;
                       ^
../src/py/libcamera/pymain.cpp:54:10: note: in instantiation of function template specialization 'ValueOrTuple<long long>' requested here
                return ValueOrTuple<int64_t>(cv);
                       ^
../src/py/libcamera/pymain.cpp:38:10: note: call 'std::move' explicitly to avoid copying
                return t;
                       ^
                       std::move(t)
../src/py/libcamera/pymain.cpp:38:10: error: local variable 't' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
                return t;
                       ^
../src/py/libcamera/pymain.cpp:56:10: note: in instantiation of function template specialization 'ValueOrTuple<float>' requested here
                return ValueOrTuple<float>(cv);
                       ^
../src/py/libcamera/pymain.cpp:38:10: note: call 'std::move' explicitly to avoid copying
                return t;
                       ^
                       std::move(t)
7 errors generated.
ninja: build stopped: subcommand failed.

It looks like pretty harmless lint/warnings, but clang won't build in the current state.

Would it be helpful if I wrote a github action/CI step to test this? I suspect its an issue on all platforms.

Video flickers when external light source is present

I'm using imx708 (imx219 has the same issue) and the video flickers when the external light source is present. There is usually a power line frequency change on USB cameras to work around that.
According to @davidplowman The AGC/AEC on the Pi is able to avoid 50/60Hz flicker by using multiples of the lighting period, but there is no API to enable it.. It would be nice to have the ability in libcamera to enable it.

Unicam instance without camera will cause the second unicam instance with camera not detected

If I have both unicam port enabled but only attach camera on CAM1 interface, libcamera will show ERROR: *** no cameras available *** even though it shows up in v4l2

v4l2-ctl --list-devices output:

pi@camera:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
        /dev/video10
        /dev/video11
        /dev/video12
        /dev/video18
        /dev/video31
        /dev/media3

bcm2835-isp (platform:bcm2835-isp):
        /dev/video13
        /dev/video14
        /dev/video15
        /dev/video16
        /dev/video20
        /dev/video21
        /dev/video23
        /dev/media1
        /dev/media2

unicam (platform:fe800000.csi):
        /dev/media4

unicam (platform:fe801000.csi):
        /dev/video0
        /dev/video1
        /dev/media5

rpivid (platform:rpivid):
        /dev/video19
        /dev/media0

If I remove the unused camera interface as the following v4l2-ctl --list-devices output shows:

pi@camera:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
        /dev/video10
        /dev/video11
        /dev/video12
        /dev/video18
        /dev/video31
        /dev/media2

bcm2835-isp (platform:bcm2835-isp):
        /dev/video13
        /dev/video14
        /dev/video15
        /dev/video16
        /dev/video20
        /dev/video21
        /dev/video22
        /dev/video23
        /dev/media0
        /dev/media1

unicam (platform:fe801000.csi):
        /dev/video0
        /dev/video1
        /dev/media4

rpivid (platform:rpivid):
        /dev/video19
        /dev/media3

It is now showing up in libcamera --list

pi@camera:~/nfs_folder $ libcamera-hello --list
Available cameras
-----------------
0 : imx283 [5592x3694] (/base/soc/i2c0mux/i2c@1/imx283@1a)
    Modes: 'SRGGB12_CSI2P' : 5592x3694 [9.47 fps - (0, 0)/5592x3694 crop]

List of configuration items to pass to the IPA

First thing we need is some way of passing the name of the JSON tuning
file to the IPA. Perhaps this can be given at the command line by the
user?

Next we need this camera sensor info class passed into the IPA that
should contain

  • List of usable modes
    Only used in the current implementation to match the mode against the application requested sizes. Not a requirement for the IPA implementation to receive the full list of supported camera modes.

  • - Currently used mode.
    Requirement

  • - Sensor name
    Required to construct the configuration file name. Until this is made a configurable parameter, the sensor name is required.

  • - Metadata parsers (we can lift our existing ones)
    To be investigated

  • - Gain/Exposure conversion routines.
    To be investigated

For the mode structures, we are using the following:

#define CAMERA_MODE_NAME_LEN 32

struct CameraMode {
	// friendly name by which we can refer to this mode
	char name[CAMERA_MODE_NAME_LEN];

	// size in pixels of frames in this mode
	uint16_t width, height;

	// size of full resolution uncropped frame ("sensor frame")
	uint16_t sensor_width, sensor_height;

	// binning factor (1 = no binning, 2 = 2-pixel binning etc.)
	uint8_t bin_x, bin_y;

	// location of top left pixel in the sensor frame
	uint16_t crop_x, crop_y;

	// scaling factor (so if uncropped, width*scale_x is sensor_width)
	double scale_x, scale_y;

	// scaling of the noise compared to the native sensor mode
	double noise_factor;

	// line time in nanoseconds
	double line_length;
};

qcam crashes after selecting camera [CM4, ov9281] when `decimal separator <> '.'`

this is with pretty recent updates.

The qcam camera selection dialogue appears. Upon clicking "OK", the SIGSEV happens.

Might this be related to the latest updates?

 $ sudo apt-cache policy libcamera*
[...]
libcamera-tools:
  Installiert:           0~git20221018+7c855784-1
libcamera0:
  Installiert:           0~git20221018+7c855784-1
libcamera-apps:
  Installiert:           0~git20221018+b89cc36-2
$ LIBCAMERA_LOG_LEVELS=*:DEBUG gdb qcam
[...]
[1:09:02.979802710] [1398] DEBUG IPAModule ipa_module.cpp:329 ipa_rpi.so: IPA module /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so is signed
[1:09:02.980056959] [1398] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so'
[1:09:02.980193342] [1398] DEBUG IPAModule ipa_module.cpp:329 ipa_vimc.so: IPA module /usr/lib/aarch64-linux-gnu/libcamera/ipa_vimc.so is signed
[1:09:02.980260469] [1398] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/aarch64-linux-gnu/libcamera/ipa_vimc.so'
[1:09:02.980347558] [1398]  INFO Camera camera_manager.cpp:293 libcamera v0.0.1+21-7c855784
[New Thread 0x7feafdee70 (LWP 1407)]
[1:09:02.981114101] [1407] DEBUG Camera camera_manager.cpp:106 Starting camera manager
[1:09:02.993062842] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "rpivid" created from /dev/media2
[1:09:02.993150134] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media2 due to 1 missing dependencies
[1:09:02.993808126] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media2 found
[1:09:02.993859939] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media2: rpivid
[1:09:02.994265867] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-codec" created from /dev/media5
[1:09:02.994313328] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media5 due to 5 missing dependencies
[1:09:02.997457257] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media5 found
[1:09:02.997595418] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media5: bcm2835-codec
[1:09:02.998048233] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-isp" created from /dev/media0
[1:09:02.998102138] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media0 due to 4 missing dependencies
[1:09:02.998452180] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-isp" created from /dev/media1
[1:09:02.998492345] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media1 due to 4 missing dependencies
[1:09:03.000719125] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media0 found
[1:09:03.000773790] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media0: bcm2835-isp
[1:09:03.002813411] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media1 found
[1:09:03.002863613] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media1: bcm2835-isp
[1:09:03.003685506] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "unicam" created from /dev/media3
[1:09:03.004106137] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media3 due to 1 missing dependencies
[1:09:03.004637449] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media3 found
[1:09:03.004676114] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media3: unicam
[1:09:03.004963084] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "unicam" created from /dev/media4
[1:09:03.005347624] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media4 due to 1 missing dependencies
[1:09:03.005866621] [1407] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media4 found
[1:09:03.005901527] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media4: unicam
[1:09:03.006346750] [1407] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerRPi'
[1:09:03.006443006] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "unicam"
[1:09:03.006511262] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "bcm2835-isp"
[1:09:03.006809398] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Exposure (0x00980911)
[1:09:03.006899228] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Horizontal Flip (0x00980914)
[1:09:03.006941263] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Vertical Flip (0x00980915)
[1:09:03.006980058] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Camera Orientation (0x009a0922)
[1:09:03.007030149] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Camera Sensor Rotation (0x009a0923)
[1:09:03.007069425] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Vertical Blanking (0x009e0901)
[1:09:03.007104979] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Horizontal Blanking (0x009e0902)
[1:09:03.007140663] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Analogue Gain (0x009e0903)
[1:09:03.007178791] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Link Frequency (0x009f0901)
[1:09:03.007220215] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Pixel Rate (0x009f0902)
[1:09:03.007257343] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 0-0060': Control: Test Pattern (0x009f0903)
[1:09:03.008273358] [1407]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[1:09:03.008337281] [1407]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[1:09:03.012149646] [1407] DEBUG IPAManager ipa_manager.cpp:303 IPA module /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so signature is valid
[1:09:03.012319509] [1407] DEBUG IPAProxy raspberrypi_ipa_proxy.cpp:45 initializing raspberrypi proxy: loading IPA from /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so
[1:09:03.504555896] [1407]  WARN RPiController controller.cpp:43 This format of the tuning file will be deprecated soon! Please use the convert_tuning.py utility to update to version 2.0.
[1:09:03.504629616] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "version"
[1:09:03.504655855] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "target"
[1:09:03.504678595] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "algorithms"
[1:09:03.504864551] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video0[21:cap]: Opened device platform:fe800000.csi: unicam: unicam
[1:09:03.505238184] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Red Balance (0x0098090e)
[1:09:03.505418232] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Blue Balance (0x0098090f)
[1:09:03.505573540] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Colour Correction Matrix (0x009819e1)
[1:09:03.505725645] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Lens Shading (0x009819e2)
[1:09:03.505873621] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Black Level (0x009819e3)
[1:09:03.506024245] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Green Equalisation (0x009819e4)
[1:09:03.506178146] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Gamma (0x009819e5)
[1:09:03.506325881] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Denoise (0x009819e6)
[1:09:03.506471930] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Sharpen (0x009819e7)
[1:09:03.506618980] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Defective Pixel Correction (0x009819e8)
[1:09:03.506764604] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Colour Denoise (0x009819e9)
[1:09:03.506911709] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[22:cap]: Control: Digital Gain (0x009f0905)
[1:09:03.507076110] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video13[22:out]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.507406615] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video14[23:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.507631161] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video15[24:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.507836264] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video16[25:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.508029090] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Horizontal Blanking
[1:09:03.508184695] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 1 for Vertical Blanking
[1:09:03.508324393] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Exposure
[1:09:03.508460757] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Analogue Gain
[1:09:03.508698470] [1407]  INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@0/ov9281@60 to Unicam device /dev/media3 and ISP device /dev/media0
[1:09:03.508854853] [1407] DEBUG Camera camera_manager.cpp:161 Pipeline handler "PipelineHandlerRPi" matched
[1:09:03.509001828] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "unicam"
[1:09:03.509171192] [1407] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "bcm2835-isp"
[1:09:03.509433940] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Exposure (0x00980911)
[1:09:03.509607526] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Horizontal Flip (0x00980914)
[1:09:03.509759131] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Vertical Flip (0x00980915)
[1:09:03.509908107] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Camera Orientation (0x009a0922)
[1:09:03.510066841] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Camera Sensor Rotation (0x009a0923)
[1:09:03.510216168] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Vertical Blanking (0x009e0901)
[1:09:03.510363403] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Horizontal Blanking (0x009e0902)
[1:09:03.510512304] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Analogue Gain (0x009e0903)
[1:09:03.510660947] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Link Frequency (0x009f0901)
[1:09:03.510811033] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Pixel Rate (0x009f0902)
[1:09:03.510955416] [1407] DEBUG V4L2 v4l2_device.cpp:627 'ov9281 10-0060': Control: Test Pattern (0x009f0903)
[1:09:03.511851047] [1407]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[1:09:03.512044706] [1407]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[1:09:03.516520970] [1407] DEBUG IPAManager ipa_manager.cpp:303 IPA module /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so signature is valid
[1:09:03.516744387] [1407] DEBUG IPAProxy raspberrypi_ipa_proxy.cpp:45 initializing raspberrypi proxy: loading IPA from /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so
[1:09:03.517415563] [1407]  WARN RPiController controller.cpp:43 This format of the tuning file will be deprecated soon! Please use the convert_tuning.py utility to update to version 2.0.
[1:09:03.517478394] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "version"
[1:09:03.517501375] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "target"
[1:09:03.517523800] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "algorithms"
[1:09:03.517767438] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video1[30:cap]: Opened device platform:fe801000.csi: unicam: unicam
[1:09:03.518000392] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Red Balance (0x0098090e)
[1:09:03.518054019] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Blue Balance (0x0098090f)
[1:09:03.518087999] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Colour Correction Matrix (0x009819e1)
[1:09:03.518121239] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Lens Shading (0x009819e2)
[1:09:03.518153774] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Black Level (0x009819e3)
[1:09:03.518185884] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Green Equalisation (0x009819e4)
[1:09:03.518218161] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Gamma (0x009819e5)
[1:09:03.518251789] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Denoise (0x009819e6)
[1:09:03.518288695] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Sharpen (0x009819e7)
[1:09:03.518321379] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Defective Pixel Correction (0x009819e8)
[1:09:03.518371358] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Colour Denoise (0x009819e9)
[1:09:03.518409060] [1407] DEBUG V4L2 v4l2_device.cpp:627 /dev/video20[31:cap]: Control: Digital Gain (0x009f0905)
[1:09:03.518464595] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video20[31:out]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.518688253] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video21[32:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.518794878] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video22[33:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.518876005] [1407] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video23[34:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[1:09:03.518926780] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Horizontal Blanking
[1:09:03.518955724] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 1 for Vertical Blanking
[1:09:03.518980111] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Exposure
[1:09:03.519003462] [1407] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Analogue Gain
[1:09:03.519106625] [1407]  INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media4 and ISP device /dev/media1
[1:09:03.519142975] [1407] DEBUG Camera camera_manager.cpp:161 Pipeline handler "PipelineHandlerRPi" matched
[1:09:03.519175011] [1407] DEBUG RPI raspberrypi.cpp:1199 Unable to acquire a Unicam instance
[1:09:03.519201547] [1407] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'SimplePipelineHandler'
[1:09:03.519250619] [1407] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerUVC'
[1:09:03.519278248] [1407] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerVimc'
[New Thread 0x7fea7cee70 (LWP 1408)]
qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 192, resource id: 0, major code: 140 (Unknown), minor code: 20
[1:09:23.909612396] [1398] DEBUG RPI raspberrypi.cpp:570 Try color space sYCC
[1:09:23.909731540] [1398] DEBUG Camera camera.cpp:967 streams configuration: (0) 800x600-NV12
[1:09:23.909880441] [1398] DEBUG RPI raspberrypi.cpp:570 Try color space sYCC
[1:09:23.910034954] [1398] DEBUG RPI raspberrypi.cpp:570 Try color space sYCC
[1:09:23.910089174] [1398]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[1:09:23.910228668] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1536 /dev/video0[21:cap]: Releasing buffers
[1:09:23.910293481] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1254 /dev/video0[21:cap]: 0 buffers requested.
[1:09:23.910327535] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1536 /dev/video13[22:out]: Releasing buffers
[1:09:23.910360848] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1254 /dev/video13[22:out]: 0 buffers requested.
[1:09:23.910389644] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1536 /dev/video14[23:cap]: Releasing buffers
[1:09:23.910420828] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1254 /dev/video14[23:cap]: 0 buffers requested.
[1:09:23.910449715] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1536 /dev/video15[24:cap]: Releasing buffers
[1:09:23.910481288] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1254 /dev/video15[24:cap]: 0 buffers requested.
[1:09:23.910509713] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1536 /dev/video16[25:cap]: Releasing buffers
[1:09:23.910544619] [1407] DEBUG V4L2 v4l2_videodevice.cpp:1254 /dev/video16[25:cap]: 0 buffers requested.
[1:09:23.910645448] [1407] DEBUG RPI raspberrypi.cpp:167 Format: 640x400 fmt R8 Score: 2820 (best 2820)
[1:09:23.910745667] [1407] DEBUG RPI raspberrypi.cpp:167 Format: 1280x720 fmt R8 Score: 2316.67 (best 2316.67)
[1:09:23.910781165] [1407] DEBUG RPI raspberrypi.cpp:167 Format: 1280x800 fmt R8 Score: 2270 (best 2270)
[1:09:23.910815145] [1407] DEBUG RPI raspberrypi.cpp:167 Format: 640x400 fmt R10 Score: 1820 (best 1820)
[1:09:23.910846181] [1407] DEBUG RPI raspberrypi.cpp:167 Format: 1280x720 fmt R10 Score: 1316.67 (best 1316.67)
[1:09:23.910877884] [1407] DEBUG RPI raspberrypi.cpp:167 Format: 1280x800 fmt R10 Score: 1270 (best 1270)
[1:09:23.911036877] [1407]  INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@0/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P
[1:09:23.912125650] [1407] DEBUG RPI raspberrypi.cpp:832 Setting ISP Output0 to 800x600-XB24
[1:09:23.912358233] [1407] DEBUG RPI raspberrypi.cpp:846 Stream ISP Output0 has color space sYCC
[1:09:23.912398102] [1407] DEBUG RPI raspberrypi.cpp:912 Setting ISP Output1 (internal) to 400x300-YU12

Thread 5 "qcam" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7feafdee70 (LWP 1407)]
libcamera::ipa::RPi::IPARPi::applyFrameDurations (this=this@entry=0x7fe000c280, minFrameDuration=..., maxFrameDuration=...) at ../src/ipa/raspberrypi/raspberrypi.cpp:1188
1188    ../src/ipa/raspberrypi/raspberrypi.cpp: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  libcamera::ipa::RPi::IPARPi::applyFrameDurations(libcamera::utils::Duration, libcamera::utils::Duration) (this=this@entry=0x7fe000c280, minFrameDuration=..., maxFrameDuration=...)
    at ../src/ipa/raspberrypi/raspberrypi.cpp:1188
#1  0x0000007ff05c6c44 in libcamera::ipa::RPi::IPARPi::configure(libcamera::IPACameraSensorInfo const&, std::map<unsigned int, libcamera::IPAStream, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, libcamera::IPAStream> > > const&, std::map<unsigned int, libcamera::ControlInfoMap, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, libcamera::ControlInfoMap> > > const&, libcamera::ipa::RPi::IPAConfig const&, libcamera::ControlList*, libcamera::ipa::RPi::IPAConfigResult*)
    (this=0x7fe000c280, sensorInfo=..., streamConfig=<optimized out>, entityControls=<optimized out>, ipaConfig=..., controls=0x7feafdd728, result=0x7feafddb00)
    at ../src/ipa/raspberrypi/raspberrypi.cpp:447
#2  0x0000007ff7f50f20 in libcamera::RPiCameraData::configureIPA(libcamera::CameraConfiguration const*, libcamera::ipa::RPi::IPAConfigResult*)
    (this=this@entry=0x7fe001e6f0, config=config@entry=0x55557c6a20, result=result@entry=0x7feafddb00) at ../src/libcamera/pipeline/raspberrypi/raspberrypi.cpp:1648
#3  0x0000007ff7f51c00 in libcamera::PipelineHandlerRPi::configure(libcamera::Camera*, libcamera::CameraConfiguration*) (this=<optimized out>, camera=<optimized out>, config=0x55557c6a20)
    at ../src/libcamera/pipeline/raspberrypi/raspberrypi.cpp:946
#4  0x0000007ff7eea428 in libcamera::BoundMethodMember<libcamera::PipelineHandler, int, libcamera::Camera*, libcamera::CameraConfiguration*>::invoke(libcamera::Camera*, libcamera::CameraConfiguration*) (args#1=<optimized out>, args#0=<optimized out>, this=<optimized out>) at ../include/libcamera/base/bound_method.h:191
#5  libcamera::BoundMethodArgs<int, libcamera::Camera*, libcamera::CameraConfiguration*>::invokePack<0ul, 1ul, int>(libcamera::BoundMethodPackBase*, std::integer_sequence<unsigned long, 0ul, 1ul>) (pack=0x5555905190, this=<optimized out>) at ../include/libcamera/base/bound_method.h:106
#6  libcamera::BoundMethodArgs<int, libcamera::Camera*, libcamera::CameraConfiguration*>::invokePack(libcamera::BoundMethodPackBase*) (this=<optimized out>, pack=0x5555905190)
    at ../include/libcamera/base/bound_method.h:124
#7  0x0000007ff7e42088 in libcamera::Object::message(libcamera::Message*) (this=<optimized out>, msg=<optimized out>) at ../src/libcamera/base/object.cpp:198
#8  libcamera::Object::message(libcamera::Message*) (this=<optimized out>, msg=<optimized out>) at ../src/libcamera/base/object.cpp:188
#9  0x0000007ff7e444f0 in libcamera::Thread::dispatchMessages(libcamera::Message::Type) (this=0x55556dba30, type=libcamera::Message::None) at ../src/libcamera/base/thread.cpp:627
#10 0x0000007ff7e3b834 in libcamera::EventDispatcherPoll::processEvents() (this=0x7fe0011200) at ../src/libcamera/base/event_dispatcher_poll.cpp:147
#11 0x0000007ff7e44218 in libcamera::Thread::exec() (this=this@entry=0x55556dba30) at ../src/libcamera/base/thread.cpp:341
#12 0x0000007ff7eed8d4 in libcamera::CameraManager::Private::run() (this=0x55556dba20) at ../src/libcamera/camera_manager.cpp:120
#13 0x0000007ff69d3cac in  () at /lib/aarch64-linux-gnu/libstdc++.so.6
#14 0x0000007ff62faf3c in start_thread (arg=0x0) at pthread_create.c:481
#15 0x0000007ff683ecdc in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:79

Image quality issues with latest libcamera-rpi revisions

Hello,
running on RPi4 with the following configuration:

  • latest master branch from this repository
    07002c0 ("DNI: Fixes for v4l2 device lost events.")
  • latest rpi-5.4.y-libcamera branch from linux-libcamera.git
    75b5c3cd5b06 ("media: ov5647: change defaults to better match most raw camera applications")
  • fw-10-3-20 from #1

gives unexpected results, the most visible one is captured images being purple-ish.

I see several errors in the libcamera output trace:
At init time

[0:10:12.378844011] [1198]  INFO Camera camera.cpp:798 configuring streams: (0) 1920x1080-0x3231564e
[0:10:12.379863024] [1199]  INFO RPI raspberrypi.cpp:585 Sensor: imx219 0-0010 - Selected mode: 1640x1232-0x41414270
[0:10:12.382117154] [1199] ERROR V4L2 v4l2_videodevice.cpp:987 /dev/video13[out]: Unable to set rectangle 0: Inappropriate ioctl for device
[0:10:12.382359778] [1199] ERROR V4L2 v4l2_device.cpp:257 /dev/video0[cap]: Control 0x009819c1 not found
[0:10:12.419866632] [1199] ERROR V4L2 v4l2_device.cpp:257 /dev/video0[cap]: Control 0x009819c2 not found
[0:10:12.420121626] [1199] ERROR V4L2 v4l2_device.cpp:257 /dev/video0[cap]: Control 0x009819c3 not found
[0:10:12.420269659] [1199] ERROR V4L2 v4l2_device.cpp:257 /dev/video0[cap]: Control 0x009819c2 not found

Problems I see here:

  1. The selected sensor mode is smaller than the requested output
  2. set selection on the ISP input node fails
    data->isp_[Isp::Input].dev()->setCrop(&crop);
  3. several controls not found

During capture

[0:08:58.668727310] [1811] ERROR IPARPI raspberrypi.cpp:748 Can't find CCM control
[0:08:58.668814680] [1811] ERROR IPARPI raspberrypi.cpp:880 Can't find LS control
[0:08:58.668865902] [1811] ERROR IPARPI raspberrypi.cpp:768 Can't find Gamma control
[0:08:58.668915772] [1811] ERROR IPARPI raspberrypi.cpp:787 Can't find black level control
[0:08:58.668964438] [1811] ERROR IPARPI raspberrypi.cpp:805 Can't find geq control
[0:08:58.669015530] [1811] ERROR IPARPI raspberrypi.cpp:823 Can't find denoise control
[0:08:58.669089067] [1811] ERROR IPARPI raspberrypi.cpp:843 Can't find sharpen control
[0:08:58.669151437] [1811] ERROR IPARPI raspberrypi.cpp:864 Can't find DPC control
[0:08:58.679973044] [1811] ERROR V4L2 v4l2_device.cpp:257 /dev/video0[cap]: Control 0x009819c2 not found
[0:08:58.680126487] [1811] ERROR V4L2 v4l2_device.cpp:299 /dev/video0[cap]: Unable to set controls: Unknown error -22
[0:08:58.680189653] [1811] ERROR V4L2 v4l2_device.cpp:257 /dev/video0[cap]: Control 0x009819c2 not found

This happens for every frame.

Can you reproduce the issue ? Is this an expected development gap ?

Getting Started fails

ninja -C build install
ninja: Entering directory build' [1/2] Installing files. Installation failed due to insufficient permissions. Attempting to use polkit to gain elevated privileges... ==== AUTHENTICATING FOR org.freedesktop.policykit.exec === Authentication is needed to run /usr/bin/python3' as the super user
Authenticating as: root
Password:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

This incident has been reported.
FAILED: meson-internal__install
/home/pi/.local/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.

Libcamera failed to get frames from OV9281 camera

Hello,
I have an OV9281 camera from Inno-maker. I used it on my Raspberry Pi 4 Model B Rev 1.5 with the latest Raspberry OS (Release date: February 21st 2023, System: 64-bit).

In order to get high framerate i use the inno-maker driver :

  1. I could check the camera
pi@raspberrypi:~ $ ls /dev/video0
/dev/video0
  1. I could check the framerate with v4l2-ctl
pi@raspberrypi:~ $ v4l2-ctl --stream-mmap --stream-count=-1 -d /dev/video0 --stream-to=/dev/null
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 253.10 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 253.10 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 253.10 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<^C
  1. I could use VLC to visualize the camera stream
  2. But i failed when using Libcamera :
pi@raspberrypi:~ $ libcamera-hello -t 0
Made X/EGL preview window
[0:00:53.575375948] [1267]  INFO Camera camera_manager.cpp:299 libcamera v0.0.4+22-923f5d70
[0:00:53.597454207] [1268] ERROR CameraSensor camera_sensor.cpp:125 'inno_mipi_ov9281 10-0060': No image format found
[0:00:53.597697522] [1268] ERROR RPI raspberrypi.cpp:1277 Failed to register camera inno_mipi_ov9281 10-0060: -22
ERROR: *** no cameras available ***

Can you help me please ?
Thank you

Reproducible builds | Libcamera

Hi!

I'm compiling libcamera from Buildroot and works great. The problem comes when I want to do reproducible builds from libcamera.
The library adds a random characters (I assume is some signature) when building.

  • Is there a way to have reproducible builds without modifying any file under libcamera repository?
  • Is unsafe under you point or view, disable the signature when building?

I saw this, and add as reference:
https://github.com/raspberrypi/libcamera/blob/main/src/libcamera/pub_key.cpp

Regards

rpi: ipa: applyLS: ISO C++ forbids converting a string constant to ‘char*’

FAILED: src/ipa/rpi/ef0d5ff@@ipa_rpi@sha/rpi.cpp.o
c++ -Isrc/ipa/rpi/ef0d5ff@@ipa_rpi@sha -Isrc/ipa/rpi -I../src/ipa/rpi -Iinclude -I../include -Isrc/libcamera/include -I../src/libcamera/include -I../src/ipa/rpi/controller -I/opt/vc/include -Iinclude/libcamera -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++11 -g -Wno-unused-parameter -include config.h -fPIC -Wno-psabi -MD -MQ 'src/ipa/rpi/ef0d5ff@@ipa_rpi@sha/rpi.cpp.o' -MF 'src/ipa/rpi/ef0d5ff@@ipa_rpi@sha/rpi.cpp.o.d' -o 'src/ipa/rpi/ef0d5ff@@ipa_rpi@sha/rpi.cpp.o' -c ../src/ipa/rpi/rpi.cpp
../src/ipa/rpi/rpi.cpp: In member function ‘void libcamera::IPARPi::applyLS(const AlscStatus&, libcamera::ControlList&)’:
../src/ipa/rpi/rpi.cpp:590:47: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
lsTable_ = vcsm_malloc(w * h * 4, "ls_grid");

Python documentation

Seeing that there is libcamera python bindings can we please get documentation on these python bindings? Looking at picamera 2 it hides away alot of complexity and I don't know how to call the libcamera python module(s) and methods by myself. Reading the code of picamera2 isn't helping me learn. Part of why picamera was great was because it had a lot of documentation (especially with MMALobject).

Unable to build: src/libcamera/meson.build:70:0: ERROR: Dependency "yaml-0.1" not found, tried pkgconfig

Get the error below when trying to run a build from the picamera2 branch. I was following instructions from https://www.raspberrypi.com/news/a-preview-release-of-the-picamera2-library/ which was dated 2/15/22. Checking out the commit from that date and building worked just fine.

The Meson build system
Version: 0.62.1
Source dir: /home/pi/libcamera
Build dir: /home/pi/libcamera/build
Build type: native build
Project name: libcamera
Project version: 0.0.0
C compiler for the host machine: cc (gcc 10.2.1 "cc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
C linker for the host machine: cc ld.bfd 2.35.2
C++ compiler for the host machine: c++ (gcc 10.2.1 "c++ (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
C++ linker for the host machine: c++ ld.bfd 2.35.2
Host machine cpu family: arm
Host machine cpu: armv7l
Header <unistd.h> has symbol "issetugid" : NO
Header <stdlib.h> has symbol "secure_getenv" : YES
Compiler for C supports arguments -Wno-c99-designator: NO
Library lttng-ust found: NO
Program ./parser.py found: YES (/home/pi/libcamera/utils/ipc/./parser.py)
Program ./generate.py found: YES (/home/pi/libcamera/utils/ipc/./generate.py)
Program ./extract-docs.py found: YES (/home/pi/libcamera/utils/ipc/./extract-docs.py)
Program ./gen-tp-header.py found: YES (/home/pi/libcamera/utils/tracepoints/./gen-tp-header.py)
Configuring version.h using configuration
Program openssl found: YES (/usr/bin/openssl)
Library atomic found: YES
Library libdw found: YES
Library libunwind found: YES
Header <execinfo.h> has symbol "backtrace" : YES
Run-time dependency threads found: YES
Library dl found: YES
Library gnutls found: YES
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency libudev found: NO (tried pkgconfig and cmake)
Run-time dependency yaml-0.1 found: NO (tried pkgconfig)

src/libcamera/meson.build:70:0: ERROR: Dependency "yaml-0.1" not found, tried pkgconfig

A full log can be found at /home/pi/libcamera/build/meson-logs/meson-log.txt
ninja: Entering directory build' ninja: error: loading 'build.ninja': No such file or directory ninja: Entering directory build'
ninja: error: loading 'build.ninja': No such file or directory

How are '--awb custom' and '--awbgains' working?

Hi, I am using a Raspberry Pi HighQuality Camera with a Sony IMX477 sensor. Playing around with libcamera on a Raspberry Pi 4 running Bullseye.

There are two things I do not understand and I couldn't find any enlightening information:

  1. What does '--awb custom' do? The other presets (tungsten, indoor, ...) are clear to me, but with 'custom' I would assume one would have to give some more arguments like '--awb custom 5600' (for Kelvin). But that is not working.
  2. How does '--awbgains 0,0' work? It should control red-green and blue-yellow shift, right? I do not understand the systematics behind it. For example I tried '--awbgains 1.0,1.0' and everything turned green. '--awbgains 1.0,0.0' on the other hand did nothing to the image.

I would appreciate some help.

Best wishes,
Alex

build error

..............................................................................................................................+++++
[42/185] Generating src/libcamera/ipa_pub_key_cpp with a custom command
writing RSA key
[184/185] Installing files.
Installation failed due to insufficient permissions.
Attempting to use polkit to gain elevated privileges...
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/python3' as the super user
Authenticating as: ,,, (dev)
Password:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

This incident has been reported.
FAILED: meson-internal__install
/home/dev/.local/bin/meson install --no-rebuild

disable_camera_led=1 in /boot/config.txt no longer works?

disable_camera_led=1 in /boot/config.txt worked previously until a recent sudo apt full-upgrade, the camera led no longer able to turn off.

Also tried the following to disable LED:

  • Seems picamera no longer supported on the 64 bit OS release, tried picamera2
    import picamera2
    
    with picamera2.Picamera2() as camera:
      camera.led = False
  • GPIO
    import RPi.GPIO as GPIO
    
    CAMLED = 32
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(CAMLED, GPIO.OUT, initial=False) 
    GPIO.output(CAMLED, False)
    • Gets warning though <stdin>:1: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.

My hardware and software info:

libcamera-apps build: 35266e84043f 07-07-2022 (17:59:45)
libcamera build: v0.0.0+3700-f30ad033
OS: Debian GNU/Linux 11 (bullseye) aarch64
Host: Raspberry Pi 3 Model B Plus Rev 1.3
Kernel: 5.15.56-v8+
Uptime: 22 mins
Packages: 1599 (dpkg)
Shell: bash 5.1.4
Terminal: /dev/pts/0
CPU: BCM2835 (4) @ 1.400GHz
Memory: 254MiB / 859MiB

RAW capture support

Two parts really.
We need to expose RAW (internal buffer pool) buffers as a stream, without impacting performance handling.

QCam or sample app needs to be able to extract those and save - ideally to DNG formats if there is time.

Remove constraints on the sensor subdevice

The following two constrains in the libcamera code code stop the RPi platform from working:

  1. Sensor subdevice must have only one pad.
    As you know, right now we are overloading the subdevice pad to
    advertise sensor embedded data is available. Eventually, we intend to
    add a "stream" property to the subdevice that can be used instead, but
    that may be some time before that's ready. Would it be possible to
    remove this constraint?

  2. Sensor subdevices must advertise the same frame sizes for all MBUS codes.
    There are sensors that we currently use (e.g. ov5647) that advertise a
    number of 10-bit modes (preferred) as well as a single 8-bit more
    (legacy use). Other sensors may require lower bit depth formats for
    fast frame rate modes as another example. With these configurations,
    this constraint seems too restrictive.

These constraints must currently be commented out in order for us to get running.

Alignment error when building with clang/clang++ 15

Building with clang/clang++ 15 toolchain results in following error

| arm-poky-linux-musleabi-clang++ -target arm-poky-linux-musleabi -marm -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s -mlittle-endian -Qunused-arguments -ffile-compilation-dir=. -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/recipe-sysroot -Isrc/libcamera/libcamera.so.0.0.0.p -Isrc/libcamera -I../git/src/libcamera -Iinclude -I../git/include -Iinclude/libcamera -Iinclude/libcamera/ipa -Iinclude/libcamera/internal -Isrc/libcamera/proxy -fcolor-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -O0 -stdlib=libc++ -Wextra-semi -Wthread-safety -Wshadow -include /home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/build/config.h -Wno-c99-designator -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/git=/usr/src/debug/libcamera/202105+gitAUTOINC+ed591e705c-r0 -fdebug-prefix-map=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/git=/usr/src/debug/libcamera/202105+gitAUTOINC+ed591e705c-r0 -fmacro-prefix-map=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/build=/usr/src/debug/libcamera/202105+gitAUTOINC+ed591e705c-r0 -fdebug-prefix-map=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/build=/usr/src/debug/libcamera/202105+gitAUTOINC+ed591e705c-r0 -fdebug-prefix-map=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/recipe-sysroot= -fmacro-prefix-map=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/recipe-sysroot= -fdebug-prefix-map=/home/yoctouser/amora/build/tmp/work/arm1176jzfshf-vfp-poky-linux-musleabi/libcamera/202105+gitAUTOINC+ed591e705c-r0/recipe-sysroot-native= -fvisibility-inlines-hidden --stdlib=libc++ -fPIC -DLIBCAMERA_BASE_PRIVATE -MD -MQ src/libcamera/libcamera.so.0.0.0.p/v4l2_device.cpp.o -MF src/libcamera/libcamera.so.0.0.0.p/v4l2_device.cpp.o.d -o src/libcamera/libcamera.so.0.0.0.p/v4l2_device.cpp.o -c ../git/src/libcamera/v4l2_device.cpp
| In file included from ../git/src/libcamera/v4l2_device.cpp:8:
| In file included from ../git/include/libcamera/internal/v4l2_device.h:15:
| ../git/include/linux/videodev2.h:1724:2: error: field  within 'v4l2_ext_control' is less aligned than 'v4l2_ext_control::(anonymous union at ../git/include/linux/videodev2.h:1724:2)' and is usually due to 'v4l2_ext_control' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
|         union {
|         ^
| 1 error generated.

It is easy to work around the error using -Wno-unaligned-access but would be worth chasing it down as this could result in subtle runtime issues.

Error running ctt tool

I am trying out ctt tool using off-the-shelf v1 camera, but am unable to run it to completion due to error ValueError: On entry to DLASCL parameter number 4 had an illegal value

$ python3 ../libcamera/utils/raspberrypi/ctt/ctt.py  -c ctt_config.json -i ov5647 -o ov5647.json


Loading images from ov5647/
Files found: 6

Loading image: 6150K_130l.dng
Locating macbeth chart
Macbeth chart located successfully
Confidence: 0.834
Image loaded successfully!

Loading image: 6150K_130l.jpg

ERROR:
No Broadcom header found
DISCARDED

Loading image: alsc_6150K_1.dng
Image loaded successfully!

Loading image: alsc_6150K_1.jpg

ERROR:
No Broadcom header found

DISCARDED

Loading image: alsc_6150K_1u.dng
Image loaded successfully!

Loading image: alsc_6150K_1u.jpg

ERROR:
No Broadcom header found

DISCARDED

Finished loading images

STARTING CALIBRATIONS

Starting ALSC calibration
Finished ALSC calibrations

Starting GEQ calibrations
Finished GEQ calibrations

Starting LUX calibrations
Finished LUX calibrations

Starting NOISE calibrations
Finished NOISE calibrations

Starting AWB calibration
Traceback (most recent call last):
  File "/home/dkt/ctt/../libcamera/utils/raspberrypi/ctt/ctt.py", line 837, in <module>
    run_ctt(json_output, directory, config, log_output)
  File "/home/dkt/ctt/../libcamera/utils/raspberrypi/ctt/ctt.py", line 801, in run_ctt
    Cam.awb_cal(greyworld, do_alsc_colour)
  File "/home/dkt/ctt/../libcamera/utils/raspberrypi/ctt/ctt.py", line 309, in awb_cal
    awb_out = awb(self, cal_cr_list, cal_cb_list, plot)
  File "/home/dkt/libcamera/utils/raspberrypi/ctt/ctt_awb.py", line 95, in awb
    a, b, c = np.polyfit(rbs_hat[0], rbs_hat[1], 2)
  File "<__array_function__ internals>", line 5, in polyfit
  File "/usr/lib/python3/dist-packages/numpy/lib/polynomial.py", line 629, in polyfit
    c, resids, rank, s = lstsq(lhs, rhs, rcond)
  File "<__array_function__ internals>", line 5, in lstsq
  File "/usr/lib/python3/dist-packages/numpy/linalg/linalg.py", line 2306, in lstsq
    x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
ValueError: On entry to DLASCL parameter number 4 had an illegal value

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.