gramods
Loading...
Searching...
No Matches
OpenCvVideoCapture.hh
1
2#ifndef GRAMODS_TRACK_OPENCVVIDEOCAPTURE
3#define GRAMODS_TRACK_OPENCVVIDEOCAPTURE
4
5#include <gmTrack/config.hh>
6
7#ifdef gramods_ENABLE_OpenCV
8
9#include <gmCore/VideoSource.hh>
10
11#include <gmCore/OFactory.hh>
12#include <gmCore/Updateable.hh>
13
14BEGIN_NAMESPACE_GMTRACK;
15
24class OpenCvVideoCapture
25 : public gmCore::Object,
26 public gmCore::VideoSource,
27 public gmCore::Updateable {
28
29public:
30
31 OpenCvVideoCapture();
32
38 void setVideoFile(std::filesystem::path file);
39
45 void setCameraId(int id);
46
54 void setCameraWidth(int W);
55
63 void setCameraHeight(int W);
64
74 void setCameraFramerate(int R);
75
85 void setCameraFourCC(std::string cc);
86
126 void setBackend(std::string b);
127
131 void update(gmCore::Updateable::clock::time_point, size_t);
132
140 bool retrieve(cv::Mat &image) override;
141
145 std::string getDefaultKey() override { return "videoSource"; }
146
147 GM_OFI_DECLARE;
148
149private:
150
151 struct Impl;
152 std::unique_ptr<Impl> _impl;
153};
154
155END_NAMESPACE_GMTRACK;
156
157#endif
158#endif
Base type for objects in the Gramods package for standardized handling of construction,...
Definition Object.hh:42
The Updateable class defines an interface for objects that may be updated, for example each execution...
Definition Updateable.hh:18
bool retrieve(cv::Mat &image) override
Retrieve the latest read image captured.
Definition OpenCvVideoCapture.cpp:209
void setCameraFramerate(int R)
Sets the framerate to request from the camera.
Definition OpenCvVideoCapture.cpp:73
void setVideoFile(std::filesystem::path file)
Sets the video file to read from.
Definition OpenCvVideoCapture.cpp:52
void setCameraId(int id)
Sets the camera id to capture data from.
Definition OpenCvVideoCapture.cpp:59
void setCameraFourCC(std::string cc)
Specifies the FourCC for the camera stream.
Definition OpenCvVideoCapture.cpp:102
void setCameraHeight(int W)
Sets the height of the resolution to request from the camera.
Definition OpenCvVideoCapture.cpp:65
std::string getDefaultKey() override
Returns the default key, in Configuration, for the Object.
Definition OpenCvVideoCapture.hh:145
void update(gmCore::Updateable::clock::time_point, size_t)
Updates the video capture to read off the next frame.
Definition OpenCvVideoCapture.cpp:192
void setBackend(std::string b)
Specifies backend to use for reading camera or video stream.
Definition OpenCvVideoCapture.cpp:106
void setCameraWidth(int W)
Sets the width of the resolution to request from the camera.
Definition OpenCvVideoCapture.cpp:69