| | #ifndef OPENPOSE_CORE_MAT_HPP |
| | #define OPENPOSE_CORE_MAT_HPP |
| |
|
| | #include <memory> |
| | #include <openpose/core/macros.hpp> |
| |
|
| | namespace op |
| | { |
| | |
| | |
| | |
| | |
| | #define OP_OP2CVMAT(opMat) \ |
| | (*((cv::Mat*)((opMat).getCvMat()))) |
| |
|
| | |
| | |
| | |
| | |
| | #define OP_OP2CVCONSTMAT(opMat) \ |
| | (*((cv::Mat*)((opMat).getConstCvMat()))) |
| |
|
| | |
| | |
| | |
| | |
| | #define OP_CV2OPMAT(cvMat) \ |
| | (op::Matrix((void*)&(cvMat))) |
| |
|
| | |
| | |
| | |
| | |
| | #define OP_CV2OPCONSTMAT(cvMat) \ |
| | (op::Matrix((const void*)&(cvMat))) |
| |
|
| | |
| | |
| | |
| | |
| | |
| | #define OP_OP2CVVECTORMAT(cvMats, opMats) \ |
| | std::vector<cv::Mat> cvMats; \ |
| | for (auto& opMat : (opMats)) \ |
| | { \ |
| | const auto cvMat = OP_OP2CVCONSTMAT(opMat); \ |
| | cvMats.emplace_back(cvMat); \ |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | #define OP_CV2OPVECTORMAT(opMats, cvMats) \ |
| | std::vector<op::Matrix> opMats; \ |
| | for (auto& cvMat : (cvMats)) \ |
| | { \ |
| | const auto opMat = OP_CV2OPMAT(cvMat); \ |
| | opMats.emplace_back(opMat); \ |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #define OP_MAT_VOID_FUNCTION(opMat, function) \ |
| | { \ |
| | cv::Mat cvMat = OP_OP2CVMAT(cvMat, opMat); \ |
| | cvMat.function; \ |
| | } |
| | #define OP_CONST_MAT_VOID_FUNCTION(opMat, function) \ |
| | { \ |
| | const cv::Mat cvMat = OP_OP2CVCONSTMAT(opMat); \ |
| | cvMat.function; \ |
| | } |
| | #define OP_MAT_RETURN_FUNCTION(outputVariable, opMat, function) \ |
| | { \ |
| | cv::Mat cvMat = OP_OP2CVMAT(cvMat, opMat); \ |
| | outputVariable = cvMat.function; \ |
| | } |
| | #define OP_CONST_MAT_RETURN_FUNCTION(outputVariable, opMat, function) \ |
| | { \ |
| | const cv::Mat cvMat = OP_OP2CVCONSTMAT(opMat); \ |
| | outputVariable = cvMat.function; \ |
| | } |
| |
|
| | |
| | |
| | |
| | class OP_API Matrix |
| | { |
| | public: |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | static void splitCvMatIntoVectorMatrix(std::vector<Matrix>& matrixesResized, const void* const cvMatPtr); |
| |
|
| | Matrix(); |
| |
|
| | |
| | |
| | |
| | |
| | explicit Matrix(const void* cvMatPtr); |
| |
|
| | |
| | |
| | |
| | explicit Matrix(const int rows, const int cols, const int type); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | explicit Matrix(const int rows, const int cols, const int type, void* cvMatPtr); |
| |
|
| | Matrix clone() const; |
| |
|
| | |
| | |
| | |
| | void* getCvMat(); |
| |
|
| | |
| | |
| | |
| | const void* getConstCvMat() const; |
| |
|
| | |
| | |
| | |
| | |
| | unsigned char* data(); |
| | |
| | |
| | |
| | |
| | const unsigned char* dataConst() const; |
| | |
| | |
| | |
| | |
| | |
| | unsigned char* dataPseudoConst() const; |
| |
|
| | |
| | |
| | |
| | static Matrix eye(const int rows, const int cols, const int type); |
| | |
| | |
| | |
| | int cols() const; |
| | |
| | |
| | |
| | int rows() const; |
| | |
| | |
| | |
| | int size(const int dimension) const; |
| | |
| | |
| | |
| | int dims() const; |
| |
|
| | |
| | |
| | |
| | bool isContinuous() const; |
| | bool isSubmatrix() const; |
| | size_t elemSize() const; |
| | size_t elemSize1() const; |
| | int type() const; |
| | int depth() const; |
| | int channels() const; |
| | size_t step1(const int i = 0) const; |
| | bool empty() const; |
| | size_t total() const; |
| | int checkVector(const int elemChannels, const int depth = -1, const bool requireContinuous = true) const; |
| |
|
| | |
| | |
| | |
| | void setTo(const double value); |
| | void copyTo(Matrix& outputMat) const; |
| |
|
| | private: |
| | |
| | |
| | struct ImplMatrix; |
| | std::shared_ptr<ImplMatrix> spImpl; |
| | }; |
| | } |
| |
|
| | #endif |
| |
|