WPILibC++ 2025.0.0-alpha-1-14-g3b6f38d
|
A source for user code to accept video frames as OpenCV images. More...
#include <cscore_cv.h>
Public Member Functions | |
CvSink ()=default | |
CvSink (const CvSink &sink) | |
CvSink (std::string_view name, VideoMode::PixelFormat pixelFormat=VideoMode::PixelFormat::kBGR) | |
Create a sink for accepting OpenCV images. More... | |
uint64_t | GrabFrame (cv::Mat &image, double timeout=0.225) |
Wait for the next frame and get the image. More... | |
uint64_t | GrabFrameNoTimeout (cv::Mat &image) |
Wait for the next frame and get the image. More... | |
uint64_t | GrabFrameDirect (cv::Mat &image, double timeout=0.225) |
Wait for the next frame and get the image. More... | |
uint64_t | GrabFrameNoTimeoutDirect (cv::Mat &image) |
Wait for the next frame and get the image. More... | |
Public Member Functions inherited from cs::ImageSink | |
void | SetDescription (std::string_view description) |
Set sink description. More... | |
std::string | GetError () const |
Get error string. More... | |
void | SetEnabled (bool enabled) |
Enable or disable getting new frames. More... | |
Public Member Functions inherited from cs::VideoSink | |
VideoSink () noexcept=default | |
VideoSink (const VideoSink &sink) | |
VideoSink (VideoSink &&sink) noexcept | |
VideoSink & | operator= (VideoSink other) noexcept |
~VideoSink () | |
operator bool () const | |
Returns true if the VideoSink is valid. More... | |
int | GetHandle () const |
Returns the VideoSink handle. More... | |
bool | operator== (const VideoSink &other) const |
Kind | GetKind () const |
Get the kind of the sink. More... | |
std::string | GetName () const |
Get the name of the sink. More... | |
std::string | GetDescription () const |
Get the sink description. More... | |
VideoProperty | GetProperty (std::string_view name) |
Get a property of the sink. More... | |
std::vector< VideoProperty > | EnumerateProperties () const |
Enumerate all properties of this sink. More... | |
bool | SetConfigJson (std::string_view config) |
Set properties from a JSON configuration string. More... | |
bool | SetConfigJson (const wpi::json &config) |
Set properties from a JSON configuration object. More... | |
std::string | GetConfigJson () const |
Get a JSON configuration string. More... | |
wpi::json | GetConfigJsonObject () const |
Get a JSON configuration object. More... | |
void | SetSource (VideoSource source) |
Configure which source should provide frames to this sink. More... | |
VideoSource | GetSource () const |
Get the connected source. More... | |
VideoProperty | GetSourceProperty (std::string_view name) |
Get a property of the associated source. More... | |
CS_Status | GetLastStatus () const |
Additional Inherited Members | |
Public Types inherited from cs::VideoSink | |
enum | Kind { kUnknown = CS_SINK_UNKNOWN , kMjpeg = CS_SINK_MJPEG , kCv = CS_SINK_CV , kRaw = CS_SINK_RAW } |
Static Public Member Functions inherited from cs::VideoSink | |
static std::vector< VideoSink > | EnumerateSinks () |
Enumerate all existing sinks. More... | |
Protected Member Functions inherited from cs::ImageSink | |
ImageSink ()=default | |
Protected Member Functions inherited from cs::VideoSink | |
VideoSink (CS_Sink handle) | |
Protected Attributes inherited from cs::VideoSink | |
CS_Status | m_status = 0 |
CS_Sink | m_handle {0} |
A source for user code to accept video frames as OpenCV images.
This is not dependent on any opencv binary ABI, and can be used with versions of most versions of OpenCV.
|
default |
|
inline |
|
inlineexplicit |
Create a sink for accepting OpenCV images.
WaitForFrame() must be called on the created sink to get each new image.
name | Source name (arbitrary unique identifier) |
pixelFormat | The pixel format to read |
|
inline |
Wait for the next frame and get the image.
Times out (returning 0) after timeout seconds. The provided image will have the pixelFormat this class was constructed with.
|
inline |
Wait for the next frame and get the image.
Times out (returning 0) after timeout seconds. The provided image will have the pixelFormat this class was constructed with. The data is backed by data in the CvSink. It will be invalidated by any grabFrame*() call on the sink.
|
inline |
Wait for the next frame and get the image.
May block forever. The provided image will have the pixelFormat this class was constructed with.
|
inline |
Wait for the next frame and get the image.
May block forever. The provided image will have the pixelFormat this class was constructed with. The data is backed by data in the CvSink. It will be invalidated by any grabFrame*() call on the sink.