Mat. For this purpose, there are special constructors taking pointers to CvMat or IplImage and the optional flag
indicating whether to copy the data or not.
Backward conversion from Mat to CvMator IplImageis provided via cast operators Mat::operator
CvMat() const and Mat::operator IplImage(). The operators do NOT copy the data.
IplImage*img = cvLoadImage("greatwave.jpg", 1);
Mat mtx(img); // convert IplImage*-> Mat
CvMat oldmat = mtx; // convert Mat -> CvMat
CV_Assert(oldmat.cols == img->width && oldmat.rows == img->height &&
oldmat.data.ptr == (uchar*)img->imageData && oldmat.step == img->widthStep);
CvMat与IplImage与Mat之间的转换
本文介绍了在OpenCV中CvMat、IplImage与Mat三种数据结构之间的转换方法。特别是从CvMat和IplImage到Mat的转换可以通过构造函数实现,并可以选择是否复制数据。相反方向的转换则通过cast操作符完成,但不会复制数据。
1950

被折叠的 条评论
为什么被折叠?



