video#

class perceptivo.types.video.Frame(*, frame: numpy.ndarray, timestamp: datetime.datetime = None, color: bool = None, cropped: Frame = None, dtype: numpy.dtype = None)#

Bases: perceptivo.types.root.PerceptivoType

Single video frame container

Variables
  • ~Frame.frame (numpy.ndarray) – Frame!

  • ~Frame.timestamp (datetime.datetime) – Time of acquisition

  • ~Frame.color (bool) – If False , grayscale (frame should be 2 dimensional or 3rd axis should be len == 1 ). if True, RGB Color.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

frame: numpy.ndarray#
timestamp: datetime.datetime#
cropped: Optional[perceptivo.types.video.Frame]#
dtype: Optional[numpy.dtype]#
color: Optional[bool]#
set_color(color)#
norm()#

make frame 0-1

property gray: numpy.ndarray#

Grayscale version of the frame, if color

crop(bbox: List[int])#

Crop with a bounding box (top, bottom, left, right), assign to self.cropped

Parameters

bbox ()

Returns

new Frame image with cropped image as its frame

class Config#

Bases: object

arbitrary_types_allowed: bool = True#
class perceptivo.types.video.Picamera_Params(*, sensor_mode: int = 0, resolution: Tuple[int, int] = (1280, 720), fps: int = 30, format: Literal['rgb', 'grayscale'] = 'grayscale', output_file: pathlib.Path = None)#

Bases: pydantic.main.BaseModel

Configuration for a perceptivo.video.cameras.PiCamera

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

sensor_mode: int#
resolution: Tuple[int, int]#
fps: int#
format: Literal['rgb', 'grayscale']#
output_file: Optional[pathlib.Path]#
class perceptivo.types.video.Camera_Calibration(picam: perceptivo.types.video.Picamera_Params, distance: float, mm_per_px: float)#

Bases: object

Parameters that define the conditions of use for a camera

Parameters
  • picam (Picamera_Params) – Parameterization of the PiCamera

  • distance (float) – distance from camera to subject in mm

  • mm_per_px (float) – approximate number of mm per pixel at a given distance

picam: perceptivo.types.video.Picamera_Params#
distance: float#
mm_per_px: float#