CvSink

class cscore.CvSink(name: str)

Bases: ImageSink

A sink for user code to accept video frames as OpenCV images.

Create a sink for accepting OpenCV images.

WaitForFrame() must be called on the created sink to get each new image.

Parameters:

name – Source name (arbitrary unique identifier)

grabFrame(image: numpy.ndarray, timeout: float = 0.225) Tuple[int, numpy.ndarray]

Wait for the next frame and get the image. Times out (returning 0) after timeout seconds. The provided image will have three 8-bit channels stored in BGR order.

Returns:

Frame time, or 0 on error (call GetError() to obtain the error message); the frame time is in the same time base as wpi::Now(), and is in 1 us increments.

grabFrameNoTimeout(image: numpy.ndarray) Tuple[int, numpy.ndarray]

Wait for the next frame and get the image. May block forever. The provided image will have three 8-bit channels stored in BGR order.

Returns:

Frame time, or 0 on error (call GetError() to obtain the error message); the frame time is in the same time base as wpi::Now(), and is in 1 us increments.