-
Notifications
You must be signed in to change notification settings - Fork 0
/
mat.h
65 lines (50 loc) · 1018 Bytes
/
mat.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef MAT_H
#define MAT_H
#include <vector>
struct Size{
int width = 0;
int height = 0;
};
enum {
CV_8U,
CV_8UC1,
CV_8UC3,
CV_16U,
CV_16UC1,
CV_16UC3,
CV_32F,
CV_32FC1,
CV_32FC3,
};
class Mat
{
public:
Mat();
Mat(int rows, int cols, int type);
Mat(int rows, int cols, int type, void *data, int step = 0);
int rows = 0;
int cols = 0;
void resize();
uint8_t *ptr(int y = 0);
const uint8_t *ptr(int y = 0) const;
bool empty() const {
return data.empty();
}
int elemSize1() const;
int depth() const;
int channels() const;
Size size() const;
std::vector<uint8_t> data;
private:
int mType = 0;
int mChannels = 0;
int mElemSize1 = 0;
int mDepth = 0;
};
inline bool operator == (const Size& s1, const Size &s2){
return s1.width == s2.width && s1.height == s2.height;
}
inline bool operator != (const Size& s1, const Size &s2){
return !operator==(s1, s2);
}
#endif // MAT_H