towhee.functional.mixins.computer_vision.ComputerVisionMixin

class towhee.functional.mixins.computer_vision.ComputerVisionMixin[source]

Bases: object

Mixin for computer vision problems.

Methods

image_imshow

read_audio

read_camera

read images from a camera.

read_video

Load video as a datacollection.

to_video

Encode a video with audio if provided.

classmethod read_camera(device_id=0, limit=-1)[source]

read images from a camera.

classmethod read_video(path, format='rgb24')[source]

Load video as a datacollection.

Parameters:
  • path – The path to the target video.

  • format – The format of the images loaded from video.

to_video(output_path, codec=None, rate=None, width=None, height=None, format=None, template=None, audio_src=None)[source]

Encode a video with audio if provided.

Parameters:
  • output_path – The path of the output video.

  • codec – The codec to encode and decode the video.

  • rate – The rate of the video.

  • width – The width of the video.

  • height – The height of the video.

  • format – The format of the video frame image.

  • template – The template video stream of the ouput video stream.

  • audio_src – The audio to encode with the video.