Module DynAIkonTrap.camera

Provides a simplified interface to the PiCamera library class. The Camera class gives provides the Frames from the camera's stream via a queue. Initialising the Camera takes care of setting up the necessary motion vector and image streams under the hood.

A Frame is defined for this system as having the motion vectors, as used in H.264 encoding, a JPEG encode image, and a UNIX-style timestamp when the frame was captured.

Classes

class Camera (settings: CameraSettings)

Acts as a wrapper class to provide a simple interface to a stream of camera frames. Each frame consists of motion vectors and a JPEG image. The frames are stored on an internal queue, ready to be read by any subsequent stage in the system.

Takes a CameraSettings object to initialise and start the camera hardware.

Methods

def close(self)
def empty(self) ‑> bool

Indicates if the queue of buffered frames is empty

Returns

bool
True if there are no more frames, otherwise False
def get(self) ‑> Frame

Retrieve the next frame from the camera

Raises

Empty
If the camera has not captured any frames since the last call

Returns

Frame
A frame from the camera video stream
class Frame (image: bytes, motion: numpy.ndarray, timestamp: float)

A frame from the camera consisting of motion and image information as well as the time of capture.

Class variables

var image : bytes
var motion : numpy.ndarray
var timestamp : float
class ImageReader (synchroniser)

Methods

def write(self, buf)
class MovementAnalyser (camera, synchroniser)

Ancestors

Methods

def analyse(self, motion)
class PiMotionAnalysis

Subclasses

class Synchroniser (output: multiprocessing.queues.Queue)

Methods

def tick_image_frame(self, image)
def tick_movement_frame(self, motion)