Hardware & cameraFreeRaspberry Pi OS

Picamera2

The official Python library for Raspberry Pi cameras — capture frames for OpenCV, AI and custom apps.

What you use it for

  • Computer vision with OpenCV
  • Motion detection and smart cameras
  • Streaming and recording from Python

Commands

Install
sudo apt install -y python3-picamera2
Take a photo from Python
python3 -c "from picamera2 import Picamera2; c=Picamera2(); c.start(); c.capture_file('test.jpg')"

Pro tips

  • Install it with apt, not pip — it depends on system camera libraries.
  • In a venv, use --system-site-packages so Picamera2 is visible.