直接使用Mat的构造函数,把你指针的位置赋给下面中的data就OK了 //! constructor for matrix headers pointing to user-allocated data Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);