5#ifndef CSCORE_CSCORE_RAW_CV_H_
6#define CSCORE_CSCORE_RAW_CV_H_
8#ifdef CSCORE_CSCORE_CV_H_
9#error "Cannot include both cscore_cv.h and cscore_raw_cv.h in the same file"
14#include <opencv2/core/mat.hpp>
51 int width,
int height,
int fps);
105 std::function<
void(uint64_t time)> processFrame);
117 uint64_t
GrabFrame(cv::Mat& image,
double timeout = 0.225);
167 rawFrame.
data =
reinterpret_cast<char*
>(image.data);
168 rawFrame.
width = image.cols;
169 rawFrame.
height = image.rows;
170 rawFrame.totalData = image.total() * image.channels();
179 std::function<
void(uint64_t time)> processFrame)
180 :
RawSink{name, processFrame} {}
188 tmpnam.copyTo(image);
198 tmpnam.copyTo(image);
210 image = cv::Mat{rawFrame.
height, rawFrame.
width, CV_8UC3, rawFrame.
data};
222 image = cv::Mat{rawFrame.
height, rawFrame.
width, CV_8UC3, rawFrame.
data};
@ WPI_PIXFMT_GRAY
Definition: RawFrame.h:55
@ WPI_PIXFMT_BGR
Definition: RawFrame.h:54
A sink for user code to accept raw video frames as OpenCV images.
Definition: cscore_raw_cv.h:78
uint64_t GrabFrameNoTimeout(cv::Mat &image)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:192
uint64_t GrabFrameNoTimeoutDirect(cv::Mat &image)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:214
uint64_t GrabFrameDirect(cv::Mat &image, double timeout=0.225)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:202
uint64_t GrabFrame(cv::Mat &image, double timeout=0.225)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:182
A source for using the raw frame API to provide opencv images.
Definition: cscore_raw_cv.h:29
void PutFrame(cv::Mat &image)
Put an OpenCV image and notify sinks.
Definition: cscore_raw_cv.h:165
A sink for user code to accept video frames as raw bytes.
Definition: cscore_raw.h:114
A source for user code to provide video frames as raw bytes.
Definition: cscore_raw.h:76
CS_Status m_status
Definition: cscore_oo.h:1002
CS_Source m_handle
Video source handle.
Definition: cscore_oo.h:473
CS_Status m_status
Definition: cscore_oo.h:470
basic_string_view< char > string_view
Definition: core.h:501
uint64_t GrabFrame(wpi::RawFrame &image, double timeout=0.225) const
Wait for the next frame and get the image.
Definition: cscore_raw.h:193
void PutSourceFrame(CS_Source source, const WPI_RawFrame &image, CS_Status *status)
uint64_t GrabFrameNoTimeout(wpi::RawFrame &image) const
Wait for the next frame and get the image.
Definition: cscore_raw.h:198
CameraServer (cscore) namespace.
Definition: cscore_oo.inc:16
fps
Definition: velocity.h:46
int pixelFormat
Definition: RawFrame.h:40
uint8_t * data
Definition: RawFrame.h:34
int height
Definition: RawFrame.h:42
int width
Definition: RawFrame.h:41
Video mode.
Definition: cscore_cpp.h:62
PixelFormat
Definition: cscore_cpp.h:63
Definition: RawFrame.h:74
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition: xchar.h:108