forked from hybridgroup/gocv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
videoio.cpp
63 lines (49 loc) · 1.34 KB
/
videoio.cpp
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
52
53
54
55
56
57
58
59
60
61
62
63
#include "videoio.h"
// VideoWriter
VideoCapture VideoCapture_New() {
return new cv::VideoCapture();
}
void VideoCapture_Close(VideoCapture v) {
delete v;
}
bool VideoCapture_Open(VideoCapture v, const char* uri) {
return v->open(uri);
}
bool VideoCapture_OpenDevice(VideoCapture v, int device) {
return v->open(device);
}
void VideoCapture_Set(VideoCapture v, int prop, double param) {
v->set(prop, param);
}
double VideoCapture_Get(VideoCapture v, int prop) {
return v->get(prop);
}
int VideoCapture_IsOpened(VideoCapture v) {
return v->isOpened();
}
int VideoCapture_Read(VideoCapture v, Mat buf) {
return v->read(*buf);
}
void VideoCapture_Grab(VideoCapture v, int skip) {
for (int i = 0; i < skip; i++) {
v->grab();
}
}
// VideoWriter
VideoWriter VideoWriter_New() {
return new cv::VideoWriter();
}
void VideoWriter_Close(VideoWriter vw) {
delete vw;
}
void VideoWriter_Open(VideoWriter vw, const char* name, const char* codec, double fps, int width,
int height, bool isColor) {
int codecCode = cv::VideoWriter::fourcc(codec[0], codec[1], codec[2], codec[3]);
vw->open(name, codecCode, fps, cv::Size(width, height), isColor);
}
int VideoWriter_IsOpened(VideoWriter vw) {
return vw->isOpened();
}
void VideoWriter_Write(VideoWriter vw, Mat img) {
*vw << *img;
}