Package edu.wpi.first.cscore.raw
Class RawSink
java.lang.Object
edu.wpi.first.cscore.VideoSink
edu.wpi.first.cscore.ImageSink
edu.wpi.first.cscore.raw.RawSink
- All Implemented Interfaces:
AutoCloseable
public class RawSink extends ImageSink
A sink for user code to accept video frames as raw bytes.
This is a complex API, most cases should use CvSink.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected long
grabFrame(RawFrame frame)
Wait for the next frame and get the image.protected long
grabFrame(RawFrame frame, double timeout)
Wait for the next frame and get the image.protected long
grabFrameNoTimeout(RawFrame frame)
Wait for the next frame and get the image.Methods inherited from class edu.wpi.first.cscore.VideoSink
close, enumerateProperties, enumerateSinks, equals, getConfigJson, getDescription, getHandle, getKind, getKindFromInt, getName, getProperty, getSource, getSourceProperty, hashCode, isValid, setConfigJson, setSource
-
Constructor Details
-
RawSink
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)
-
-
Method Details
-
grabFrame
Wait for the next frame and get the image. Times out (returning 0) after 0.225 seconds. The provided image will have three 8-bit channels stored in BGR order.- Parameters:
frame
- The frame object in which to store the image.- 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.
-
grabFrame
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.- Parameters:
frame
- The frame object in which to store the image.timeout
- The frame timeout in seconds.- 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
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.- Parameters:
frame
- The frame object in which to store the image.- 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.
-