blinkenxmas.cameras
The blinkenxmas.cameras module defines abstractions for the various
camera backends that Blinken’ Xmas supports. The classes are as follows:
Camera classes
- class blinkenxmas.cameras.AbstractSource(config)[source]
An abstract camera source.
The config is the application configuration object (a
Namespaceinstance).- frame
The current preview frame’s data. This is a
bytesstring containing the JPEG data of the frame.
- frame_ready
A
Conditionwhich clients must wait upon to be notified of a new JPEG available inframe.
- add_client(client)[source]
Called to add client (a
BaseHTTPRequestHandlerinstance) to the list of clients wanting to receive live preview frames from the camera.
- capture(angle, led=None)[source]
Capture a high-quality (highest possible resolution) image of the tree at angle with led lit full white. Expected to return a file-like object containing the JPEG image data.
- remove_client(client)[source]
Called to remove client (a
BaseHTTPRequestHandlerinstance) from the list of clients wanting to receive live preview frames from the camera.
- class blinkenxmas.cameras.FilesSource(config)[source]
This “camera” is primarily intended for testing purposes. It is implemented simple as a list of JPEG files which must conform to the following naming convention:
angleA_base.jpgThe base “unlit” image of the tree at the specified angle n (in degrees), where A is zero-padded to three digits. For example
angle090_base.jpg.angleA_ledL.jpgThe image of the tree at angle A (in degrees, zero-padded to three digits) with LED at index L (zero-padded to three digits) lit bright white. For example
angle090_led049.jpg.
- capture(angle, led=None)[source]
Capture a high-quality (highest possible resolution) image of the tree at angle with led lit full white. Expected to return a file-like object containing the JPEG image data.
- class blinkenxmas.cameras.PiCameraSource(config)[source]
A camera implementation that uses the legacy
picameralibrary.Warning
Be warned that this will only work with Raspberry Pi models up to the 4B (specifically not the Pi 5), and only with legacy 32-bit versions of RaspiOS or Ubuntu.
- capture(angle, led=None)[source]
Capture a high-quality (highest possible resolution) image of the tree at angle with led lit full white. Expected to return a file-like object containing the JPEG image data.
- class blinkenxmas.cameras.GStreamerSource(config)[source]
A camera implementation based on GStreamer.
This is primarily intended for use with USB web-cams. However, be warned that most USB web-cams have terrible quality compared to proper camera modules. You are far better off using a Pi camera module.
- capture(angle, led=None)[source]
Capture a high-quality (highest possible resolution) image of the tree at angle with led lit full white. Expected to return a file-like object containing the JPEG image data.
Support classes
- class blinkenxmas.cameras.PiCameraOutput(source)[source]
A
picameracustom output used byPiCameraSourceto route preview frames to clients.