关于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);
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);
相关文章推荐
- 关于OpenCV的Mat画图问题
- opencv中Mat的一些常见操作
- opencv中关于Mat的智能指针的使用
- opencv2 在mfc窗口中显示关于cv::Mat 的解决方法
- 关于opencv里Mat的知识
- 【opencv学习】关于Mat释放的问题
- 关于在console中查看opencv Mat 矩阵元素的问题
- OpenCV关于稀疏光流跟踪的演示程序以及一些错误提示
- 【opencv 官方教程】后续1 关于Mat CvMat IplImage
- OpenCV和关于VS平台的一些编程总结
- 关于小机的一些售前信息(摘自 走入小型机世界-Orian)
- OPENCV中关于MAT介绍二
- 【OpenCv】Mat中常用的一些
- 关于opencv的一些基本概念-通道概念
- opencv2.4.9 关于findcontours的一些程序
- 关于OPENCV移植应用一些很有用的网站
- 关于opencv学习中的一些杂记
- 关于配置Opencv3.1+VS2015的一些资料总结
- 关于GDAL中RasterIO和OpenCV中Mat.data的关系记录
- 关于opencv中Mat数据对齐的问题