CvSource
- class cscore.CvSource(*args, **kwargs)
Bases:
ImageSourceA source for user code to provide OpenCV images as video frames.
Overloaded function.
__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
__init__(self: cscore._cscore.CvSource, name: str, pixel_format: 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)
pixel_format – Pixel format
width – width
height – height
fps – fps
- put_frame(*args, **kwargs)
Overloaded function.
put_frame(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
put_frame(self: cscore._cscore.CvSource, image: numpy.ndarray, pixel_format: wpiutil._wpiutil.PixelFormat, skip_verification: 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
pixel_format – The pixel format of the image
skip_verification – skip verifying pixel format