On February 15, 2022, Raspberry Pi’s engineer, David Plowman, announced the release of the Picamera2 library as a replacement for the existing Python-based Picamera package. For those who have already worked with interfacing cameras on the Raspberry Pi computer, you are probably familiar with the Picamera library designed to ease the image processing on the RPi. As the Raspberry Pi Foundation pledges towards building more open and standard Linux APIs, the existing Picamera library built on the proprietary Broadcom camera stcameraacamerack would be no good.
The original Picamera library was third-party software, developed by Dave Jones and not worked on by us here at Raspberry Pi. However, the library proved immensely popular with our users, so we’ve undertaken to provide a replacement. Imaginatively named Picamera2, the new library is being developed in-house here in Cambridge by Raspberry Pi, and will eventually be an officially supported package.
says David Plowman.
As the release comes with the tag “preview” suggesting that there is much of a work in progress with some important things missing in the initial release. Also, as a public-facing API, the designer notes that certain aspects of the functionalities might change before the final release is made. As part of the preview release, the Picamera2 python library allows you to configure and start the camera to receive multiple image streams. The package also supports preview windows, either standalone or embedded within the Qt applications.
Additionally, there comes a query and set camera parameters that allow you to capture full-resolution still images as JPEGs and PNGs. For image analysis and processing, the package enabled picture capture as NumPy arrays to feed them as input. Unfortunately, for recording video from Python using Picamera2, the library doesn’t seem to support it in the preview version, but won’t be long to see it added to the final release.
With the preview release, we have already started witnessing preliminary usage of the Picamera2 library with TensorFlow Lite. [Alasdair Allan], head of documentation at the Raspberry Pi Foundation, published a detailed blog post explaining the work carried out with TensorFlow and Raspberry Pi with Picamera2 to test QtGL preview window and overlay real-time object detection on the stream.