您的位置:首页 > 运维架构

关于Mat的一些事,摘自opencv2refman

2013-01-10 21:59 176 查看
Partial yet very common cases of this user-allocated data case are conversions from CvMat and IplImage to

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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: