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"
12#include <opencv2/core/mat.hpp>
49 int width,
int height,
int fps);
103 std::function<
void(
uint64_t time)> processFrame);
165 rawFrame.
data =
reinterpret_cast<char*
>(image.data);
166 rawFrame.
width = image.cols;
167 rawFrame.
height = image.rows;
168 rawFrame.
totalData = image.total() * image.channels();
176 std::function<
void(
uint64_t time)> processFrame)
177 :
RawSink{name, processFrame} {}
185 tmpnam.copyTo(image);
195 tmpnam.copyTo(image);
207 image = cv::Mat{rawFrame.
height, rawFrame.
width, CV_8UC3, rawFrame.
data};
219 image = cv::Mat{rawFrame.
height, rawFrame.
width, CV_8UC3, rawFrame.
data};
A sink for user code to accept raw video frames as OpenCV images.
Definition: cscore_raw_cv.h:76
uint64_t GrabFrameNoTimeout(cv::Mat &image)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:189
uint64_t GrabFrameNoTimeoutDirect(cv::Mat &image)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:211
uint64_t GrabFrameDirect(cv::Mat &image, double timeout=0.225)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:199
uint64_t GrabFrame(cv::Mat &image, double timeout=0.225)
Wait for the next frame and get the image.
Definition: cscore_raw_cv.h:179
A source for using the raw frame API to provide opencv images.
Definition: cscore_raw_cv.h:27
void PutFrame(cv::Mat &image)
Put an OpenCV image and notify sinks.
Definition: cscore_raw_cv.h:163
A sink for user code to accept video frames as raw bytes.
Definition: cscore_raw.h:138
A source for user code to provide video frames as raw bytes.
Definition: cscore_raw.h:100
CS_Status m_status
Definition: cscore_oo.h:853
CS_Source m_handle
Definition: cscore_oo.h:352
CS_Status m_status
Definition: cscore_oo.h:351
basic_string_view< char > string_view
Definition: core.h:520
@ CS_PIXFMT_BGR
Definition: cscore_c.h:95
@ CS_PIXFMT_GRAY
Definition: cscore_c.h:96
uint64_t GrabFrame(RawFrame &image, double timeout=0.225) const
Wait for the next frame and get the image.
Definition: cscore_raw.h:217
uint64_t GrabFrameNoTimeout(RawFrame &image) const
Wait for the next frame and get the image.
Definition: cscore_raw.h:222
::uint64_t uint64_t
Definition: Meta.h:58
CameraServer (cscore) namespace.
Definition: cscore_oo.inc:15
void PutSourceFrame(CS_Source source, cv::Mat &image, CS_Status *status)
fps
Definition: velocity.h:46
int totalData
Definition: cscore_raw.h:23
int width
Definition: cscore_raw.h:21
int pixelFormat
Definition: cscore_raw.h:20
char * data
Definition: cscore_raw.h:18
int height
Definition: cscore_raw.h:22
Definition: cscore_raw.h:63
Video mode.
Definition: cscore_cpp.h:64
PixelFormat
Definition: cscore_cpp.h:65
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition: xchar.h:87