Commit 235a9c3b5d8e52bf229cb56f483076c50b20bd9b
1 parent
844b6435
implemented MatFromMatrix
Showing
1 changed file
with
16 additions
and
0 deletions
sdk/plugins/llvm.cpp
| ... | ... | @@ -65,6 +65,22 @@ static Matrix MatrixFromMat(const cv::Mat &mat) |
| 65 | 65 | return m; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | +static Mat MatFromMatrix(const Matrix &m) | |
| 69 | +{ | |
| 70 | + int depth = -1; | |
| 71 | + switch (m.type()) { | |
| 72 | + case Matrix::u8: depth = CV_8U; break; | |
| 73 | + case Matrix::s8: depth = CV_8S; break; | |
| 74 | + case Matrix::u16: depth = CV_16U; break; | |
| 75 | + case Matrix::s16: depth = CV_16S; break; | |
| 76 | + case Matrix::s32: depth = CV_32S; break; | |
| 77 | + case Matrix::f32: depth = CV_32F; break; | |
| 78 | + case Matrix::f64: depth = CV_64F; break; | |
| 79 | + default: qFatal("Unrecognized matrix depth."); | |
| 80 | + } | |
| 81 | + return Mat(m.rows, m.columns, CV_MAKETYPE(depth, m.channels), m.data).clone(); | |
| 82 | +} | |
| 83 | + | |
| 68 | 84 | static void AllocateMatrixFromMat(Matrix &m, cv::Mat &mat) |
| 69 | 85 | { |
| 70 | 86 | int cvType = -1; | ... | ... |