darcyai.input.camera_stream

CameraStream Objects

class CameraStream(InputStream)

An input stream that gets frames from camera.

Arguments

  • use_pi_camera (bool): Whether or not to use the Raspberry Pi camera. Defaults to False.
  • video_device (str): The video device to use. Defaults to None.
  • video_width (int): The width of the video frames. Defaults to 640.
  • video_height (int): The height of the video frames. Defaults to 480.
  • flip_frames (bool): Whether or not to flip the video frames. Defaults to False.
  • fps (int): The frames per second to stream. Defaults to 30.

Examples

>>> from darcyai.input.camera_stream import CameraStream
>>> pi_camera = CameraStream(use_pi_camera=True)
>>> usb_camera = CameraStream(video_device="/dev/video0")

stop

def stop() -> None

Stops the video stream.

Examples

>>> from darcyai.input.camera_stream import CameraStream
>>> usb_camera = CameraStream(video_device="/dev/video0")
>>> usb_camera.stop()

stream

def stream() -> Iterable[VideoStreamData]

Streams the video frames.

Returns

An iterable of VideoStreamData objects.

Examples

>>> from darcyai.input.camera_stream import CameraStream
>>> usb_camera = CameraStream(video_device="/dev/video0")
>>> usb_camera.stream()

get_video_inputs

@staticmethod
def get_video_inputs()

Gets the available video inputs.

Returns

int[]: A list of strings.

Examples

>>> from darcyai.input.camera_stream import CameraStream
>>> CameraStream.get_video_inputs()