A sink for user code to accept video frames as raw bytes.
More...
#include <wpi/cs/RawSink.hpp>
A sink for user code to accept video frames as raw bytes.
This is a complex API, most cases should use CvSource.
◆ RawSink() [1/3]
| wpi::cs::RawSink::RawSink |
( |
| ) |
|
|
default |
◆ RawSink() [2/3]
| wpi::cs::RawSink::RawSink |
( |
std::string_view | name | ) |
|
|
inlineexplicit |
Create a sink for accepting raw images.
GrabFrame() must be called on the created sink to get each new image.
- Parameters
-
| name | Source name (arbitrary unique identifier) |
◆ RawSink() [3/3]
| wpi::cs::RawSink::RawSink |
( |
std::string_view | name, |
|
|
std::function< void(uint64_t time)> | processFrame ) |
|
inline |
Create a sink for accepting raws images in a separate thread.
A thread will be created that calls WaitForFrame() and calls the processFrame() callback each time a new frame arrives.
- Parameters
-
| name | Source name (arbitrary unique identifier) |
| processFrame | Frame processing function; will be called with a time=0 if an error occurred. processFrame should call GetImage() or GetError() as needed, but should not call (except in very unusual circumstances) WaitForImage(). |
◆ GrabFrame()
| uint64_t wpi::cs::RawSink::GrabFrame |
( |
wpi::util::RawFrame & | image, |
|
|
double | timeout = 0.225 ) const |
|
inlinenodiscardprotected |
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::util::Now(), and is in 1 us increments.
◆ GrabFrameLastTime()
| uint64_t wpi::cs::RawSink::GrabFrameLastTime |
( |
wpi::util::RawFrame & | image, |
|
|
uint64_t | lastFrameTime, |
|
|
double | timeout = 0.225 ) const |
|
inlinenodiscardprotected |
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.
If lastFrameTime is provided and non-zero, the sink will fill image with the first frame from the source that is not equal to lastFrameTime. If lastFrameTime is zero, the time of the current frame owned by the CvSource is used, and this function will block until the connected CvSource provides a new frame.
- 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::util::Now(), and is in 1 us increments.
◆ GrabFrameNoTimeout()
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::util::Now(), and is in 1 us increments.
The documentation for this class was generated from the following file: