CvSource

class cscore.CvSource(*args, **kwargs)

Bases: ImageSource

A source for user code to provide OpenCV images as video frames.

Overloaded function.

  1. __init__(self: cscore._cscore.CvSource, name: str, mode: cscore._cscore.VideoMode) -> None

Create an OpenCV source.

Parameters:
  • name – Source name (arbitrary unique identifier)

  • mode – Video mode being generated

  1. __init__(self: cscore._cscore.CvSource, name: str, pixelFormat: wpiutil._wpiutil.PixelFormat, width: typing.SupportsInt | typing.SupportsIndex, height: typing.SupportsInt | typing.SupportsIndex, fps: typing.SupportsInt | typing.SupportsIndex) -> None

Create an OpenCV source.

Parameters:
  • name – Source name (arbitrary unique identifier)

  • pixelFormat – Pixel format

  • width – width

  • height – height

  • fps – fps

putFrame(*args, **kwargs)

Overloaded function.

  1. putFrame(self: cscore._cscore.CvSource, image: numpy.ndarray) -> None

Put an OpenCV image and notify sinks

The image format is guessed from the number of channels. The channel mapping is as follows. 1: kGray 2: kYUYV 3: BGR 4: BGRA Any other channel numbers will throw an error. If your image is an in alternate format, use the overload that takes a PixelFormat.

Parameters:

image – OpenCV Image

  1. putFrame(self: cscore._cscore.CvSource, image: numpy.ndarray, pixelFormat: wpiutil._wpiutil.PixelFormat, skipVerification: bool) -> None

Put an OpenCV image and notify sinks.

The format of the Mat must match the PixelFormat. You will corrupt memory if they dont. With skipVerification false, we will verify the number of channels matches the pixel format. If skipVerification is true, this step is skipped and is passed straight through.

Parameters:
  • image – OpenCV image

  • pixelFormat – The pixel format of the image

  • skipVerification – skip verifying pixel format