DynAIkonTrap.camera#

Provides a simplified interface to the PiCamera library class. The Camera class 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

Camera(settings)

Acts as a wrapper class to provide a simple interface to a stream of camera frames.

Frame(image, motion, timestamp)

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

ImageReader(synchroniser)

MovementAnalyser(camera, synchroniser)

PiMotionAnalysis()

Synchroniser(output)

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.

close()#
empty() bool#

Indicates if the queue of buffered frames is empty

Returns

True if there are no more frames, otherwise False

Return type

bool

get() Frame#

Retrieve the next frame from the camera

Raises

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

Returns

A frame from the camera video stream

Return type

Frame

class Frame(image: bytes, motion: ndarray, timestamp: float)#

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

image: bytes#
motion: ndarray#
timestamp: float#
class ImageReader(synchroniser)#
write(buf)#
class MovementAnalyser(camera, synchroniser)#
analyse(motion)#
class PiMotionAnalysis#
class Synchroniser(output: Queue)#
tick_image_frame(image)#
tick_movement_frame(motion)#