-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbullet3_adapter.h
51 lines (39 loc) · 1.07 KB
/
bullet3_adapter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef VBROPENCV_ADAPTER_H
#define VBROPENCV_ADAPTER_H
#include <opencv2/opencv.hpp>
#include <memory>
namespace VBR
{
class VideoAdapter
{
public:
VideoAdapter();
~VideoAdapter();
bool open(const std::string& filename);
void close();
bool is_opened() const {
return m_video_capture != nullptr && m_video_capture->isOpened();
}
int get_width() const;
int get_height() const;
int get_fps() const;
// read the next frame from the video capture object
bool read();
// returns the current frame
const cv::Mat& get_frame() const {
return m_frame;
}
// current frame raw data
const unsigned char* get_data() const {
return m_frame.data;
}
// current frame size
int get_size() const {
return m_frame.total() * m_frame.elemSize();
}
private:
std::unique_ptr<cv::VideoCapture> m_video_capture;
cv::Mat m_frame;
};
}
#endif // VBROPENCV_ADAPTER_H