码迷,mamicode.com
首页 > 其他好文 > 详细

mat 和IPIImage之间的转换

时间:2015-06-14 10:56:22      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:

opencv2.3.1

 

Mat::operator IplImage
Creates the IplImage header for the matrix.
C++: Mat::operator IplImage() const
The operator creates the IplImage header for the matrix without copying the underlying data. You should make sure
than the original matrix is not deallocated while the IplImage header is used. Similarly to Mat::operator CvMat ,
the operator is useful for intermixing the new and the old OpenCV API’s.

 

Backward conversion from Mat to CvMat or IplImage is 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);

 

mat 和IPIImage之间的转换

标签:

原文地址:http://www.cnblogs.com/haoxing990/p/4574681.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!