Base Classes
BaseCamera
Base class for all camera implementations. Methods:Returns the most recently captured frame
Camera Implementations
PiCamera
Raspberry Pi camera using the Picamera2 library (Bullseye and later). Constructor:Image width in pixels
Image height in pixels
Image depth/channels (3 for RGB, 1 for grayscale)
Flip image vertically
Flip image horizontally
Captures and returns a new frame from the camera buffer
Continuously captures frames in a threaded loop
Stops the camera and releases resources
Webcam
USB webcam using pygame camera interface. Constructor:Image width in pixels
Image height in pixels
Image depth/channels (3 for RGB, 1 for grayscale)
Target framerate in Hz
Index of the camera device to use
Captures and returns a new frame
Continuously captures frames at the specified framerate
Stops the camera and releases resources
CSICamera
Jetson Nano CSI camera using GStreamer. Constructor:Output image width in pixels
Output image height in pixels
Image depth/channels
Sensor capture width
Sensor capture height
Camera framerate
Flip method: 0=none, 1=rotate CCW 90°, 2=flip vertical, 3=rotate CW 90°
Captures and returns a new frame
Continuously captures frames in a threaded loop
Stops the camera and releases resources
V4LCamera
Video4Linux camera using v4l2capture library. Constructor:Image width in pixels
Image height in pixels
Video device path
Video format FourCC code
Mock/Testing Cameras
MockCamera
Returns a static image for testing. Constructor:Optional image array to use. If None, creates a blank image.
ImageListCamera
Returns images from a directory in sequence. Constructor:Glob pattern for image files
Returns the next image in the sequence
Configuration
Cameras are typically configured inmyconfig.py:
Integration Example
From templates likecomplete.py:
