P2DingoCV.Camera.CameraFactory

Classes

CameraFactory()

Factory class to create appropriate Camera instances based on the given input source.

class P2DingoCV.Camera.CameraFactory.CameraFactory[source]

Bases: object

Factory class to create appropriate Camera instances based on the given input source.

This class abstracts the logic of selecting the correct Camera subclass (VideoCamera or ImageCamera) based on whether the input is a device index, a single image file, a video file, or a directory of images.

create(source

int | str) -> Camera: Returns a Camera instance corresponding to the given source.

Factory class to create appropriate Camera instances based on input.

static create(source)[source]

Create a Camera instance based on the input source.

Parameters:

source (int | str) – The input source. Can be: - int: Device index for a webcam or capture device. - str: Path to a video file, an image file, or a directory of images.

Returns:

An instance of VideoCamera or ImageCamera.

Return type:

Camera

Raises:

ValueError – If the source type or file extension is unsupported.