2

Since the Raspberry Pi is transitioning from using the old raspistill and raspivid to the newer libcamera how should I take an image now if I don't want to use the CLI nor C as programming language? I can't find any wrapper for libcamera in any language other than C and the new official Picamera2 library is also in an alpha phase and not recommended for production use.

I am also using a 64-bit version of the Raspberry Pi OS so I can't use the legacy camera interface. I could downgrade to 32-bit but where is the point in deprecating the old system if the new one is clearly not ready for productive use.

How do you guys handle using the camera of the Raspberry Pi at the moment if you want to use a wrapper like Picamera? Am I missing something?

jonashoen
  • 23
  • 4

2 Answers2

0

Did you try to see if the cam utility is installed?

eldavo
  • 13
  • 4
  • The camera itself and libcamera are working great. The cam utility is described as utility for basic testing. I am searching for a libcamera wrapper which provides the same or equal functionalities as Picamera does for raspistill and raspivid – jonashoen Jul 03 '22 at 16:09
  • 1
    Take a look at [libcamera-apps](https://www.raspberrypi.com/documentation/accessories/camera.html#libcamera-and-libcamera-apps) – eldavo Jul 03 '22 at 16:13
  • `libcamera-apps` are the CLI tools which I described in the post and can't use. I am searching for a wrapper library like Picamera in order to use the camera programmatically – jonashoen Jul 03 '22 at 16:16
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 07 '22 at 22:45
  • Picamera is depreciated. The Picamera2 is latest version for libcamera and not for Picamera. The Picamera will work w/o using installing libcamera. – toyota Supra Sep 27 '22 at 20:39
0

At the moment, the best way, if you want to use bullseye, is probably to run libcamera-vid and pipe the output from that into a Python script. You can either use a subprocess() call, or just start a pipeline:

libcamera-vid <params> | python script.py

Be sure to read from sys.stdin.buffer like here to avoid CR/LF mangling.

Probably choose a YUV-based format to ensure frames are a deterministic length, as opposed to MJPEG where the frame length will vary according to image content and you'll have to search for JPEG SOI/EOI markers.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432