| 18 | namespace cv |
| 19 | { |
| 20 | struct Mat |
| 21 | { |
| 22 | private: |
| 23 | shared_ptr<void> dataMgr; |
| 24 | |
| 25 | public: |
| 26 | void* data; |
| 27 | int cols; // Width |
| 28 | int rows; // Height |
| 29 | int flags; // OpenCV flags |
| 30 | struct |
| 31 | { |
| 32 | int buf[2]; // Buf[0] = width of the containing |
| 33 | // buffer*channels; buff[1] = channels |
| 34 | } step; |
| 35 | |
| 36 | Mat() |
| 37 | : data(nullptr) |
| 38 | , cols(0) |
| 39 | , rows(0) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | Mat& operator=(Mat&& o) |
| 44 | { |
| 45 | data = o.data; |
| 46 | dataMgr = std::move(o.dataMgr); |
| 47 | cols = o.cols; |
| 48 | rows = o.rows; |
| 49 | |
| 50 | return *this; |
| 51 | } |
| 52 | |
| 53 | template <typename T> |
| 54 | void create(int rows_, int cols_, int channels_) |
| 55 | { |
| 56 | cols = cols_; |
| 57 | rows = rows_; |
| 58 | step = {cols_ * channels_ * static_cast<int>(sizeof(T)), channels_}; |
| 59 | |
| 60 | const int OID_TYPES_UINT8 = 0; |
| 61 | const int OID_TYPES_UINT16 = 2; |
| 62 | const int OID_TYPES_INT16 = 3; |
| 63 | const int OID_TYPES_INT32 = 4; |
| 64 | const int OID_TYPES_FLOAT32 = 5; |
| 65 | const int OID_TYPES_FLOAT64 = 6; |
| 66 | |
| 67 | const int CV_CN_SHIFT = 3; |
| 68 | |
| 69 | flags = (channels_ - 1) << CV_CN_SHIFT; |
| 70 | |
| 71 | if (is_same<T, uint8_t>::value) { |
| 72 | flags |= OID_TYPES_UINT8; |
| 73 | } else if (is_same<T, uint16_t>::value) { |
| 74 | flags |= OID_TYPES_UINT16; |
| 75 | } else if (is_same<T, int16_t>::value) { |
| 76 | flags |= OID_TYPES_INT16; |
| 77 | } else if (is_same<T, int32_t>::value) { |
nothing calls this directly
no outgoing calls
no test coverage detected