New libcamera based python library
BSD-2-CLAUSE License
Picamera2 is the libcamera-based replacement for Picamera which was a Python interface to the Raspberry Pi's legacy camera stack. Picamera2 also presents an easy to use Python API.
You can find documentation here which should help you to get started.
There are also many examples in the examples
folder of this repository, and some further Qt application examples in the apps
folder.
Picamera2 is only supported on Raspberry Pi OS Bullseye (or later) images, both 32 and 64-bit. As of September 2022, Picamera2 is pre-installed on images downloaded from Raspberry Pi. It works on all Raspberry Pi boards right down to the Pi Zero, although performance in some areas may be worse on less powerful devices.
Picamera2 is not supported on:
On Raspberry Pi OS images, Picamera2 is now installed with all the GUI (Qt and OpenGL) dependencies. On Raspberry Pi OS Lite, it is installed without the GUI dependencies, although preview images can still be displayed using DRM/KMS. If these users wish to use the additional X-Windows GUI features, they will need to run
sudo apt install -y python3-pyqt5 python3-opengl
(No changes are required to Picamera2 itself.)
apt
apt
is the recommended way of installing and updating Picamera2.
If Picamera2 is already installed, you can update it with sudo apt install -y python3-picamera2
, or as part of a full system update (for example, sudo apt upgrade
).
If Picamera2 is not already installed, then your image is presumably older and you should start with
sudo apt update
sudo apt upgrade
If you have installed Picamera2 previously using pip
, then you should also uninstall this (pip3 uninstall picamera2
).
Thereafter, you can install Picamera2 with all the GUI (Qt and OpenGL) dependencies using
sudo apt install -y python3-picamera2
If you do not want the GUI dependencies, use
sudo apt install -y python3-picamera2 --no-install-recommends
pip
This is no longer the recommended way to install Picamera2. However, if you want to do so you can use
sudo apt install -y python3-libcamera python3-kms++
sudo apt install -y python3-pyqt5 python3-prctl libatlas-base-dev ffmpeg python3-pip
pip3 install numpy --upgrade
pip3 install picamera2[gui]
which will install Picamera2 with all the GUI (Qt and OpenGL) dependencies. If you do not want these, please use
sudo apt install -y python3-libcamera python3-kms++
sudo apt install -y python3-prctl libatlas-base-dev ffmpeg libopenjp2-7 python3-pip
pip3 install numpy --upgrade
pip3 install picamera2
Please note that the "main" branch of this repository corresponds to the currently released version of Picamera2 so that the examples there can be referred to by users. Development for forthcoming releases happens on the "next" branch.
We are happy to receive pull requests (normally for the "next" branch) that will fix bugs, add features and generally improve the code. Pull requests should be:
tools/run_tests
script. Please use tools/run_tests --help
for more information.Signed-off-by: Your Name <[email protected]>
.pip3 install pre-commit
pre-commit install
This will install flake8 in a venv and will perform linting of changes prior to committing.
Thank you!