mat 和IPIImage之间的转换
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.
imread
Loads an image from a file.
C++: Mat imread(const string& filename, int flags=1 )
Python: cv2.imread(filename[, flags ]) !retval
C: IplImage* cvLoadImage(const char* filename, int flags=CV_LOAD_IMAGE_COLOR )
C: CvMat* cvLoadImageM(const char* filename, int flags=CV_LOAD_IMAGE_COLOR )
Python: cv.LoadImage(filename, flags=CV_LOAD_IMAGE_COLOR)! None
Python: cv.LoadImageM(filename, flags=CV_LOAD_IMAGE_COLOR)! None
Parameters
filename – Name of file to be loaded.
flags – Flags specifying the color type of a loaded image
– >0 Return a 3-channel color image
– =0 Return a grayscale image
– <0 Return the loaded image as is. Note that in the current implementation the alpha
channel, if any, is stripped from the output image. For example, a 4-channel RGBA
image is loaded as RGB if flags 0 .
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之间的转换的更多相关文章
- OpenCV图片类cv::Mat和QImage之间进行转换(好多相关文章)
在使用Qt和OpenCV混合编程时,我们有时需要在两种图片类cv::Mat和QImage之间进行转换,下面的代码参考了网上这个帖子: //##### cv::Mat ---> QImage ## ...
- Mat ,IplImage, CvMat 之间的转换的总结
在新版本与旧版本之间纠结,到底是用Mat,还是Iplimage? Mat 侧重于数据计算,而Iplimage注重于图像的处理. 因此,应根据具体需要灵活使用,那个好用用哪个,只要在两者之间进行转换即可 ...
- CvMat、Mat、IplImage之间的转换详解及实例
见原博客:http://blog.sina.com.cn/s/blog_74a459380101obhm.html OpenCV学习之CvMat的用法详解及实例 CvMat是OpenCV比较基础的函数 ...
- OpenCV Mat与UIImage之间的转换
UIImage 转 OpenCV cvMat: - (cv::Mat)cvMatWithImage:(UIImage *)image { CGColorSpaceRef colorSpace = CG ...
- 【opencv基础】opencv和dlib库中rectangle类型之间的转换
前言 最近使用dlib库的同时也会用到opencv,特别是由于对dlib库的画图函数不熟悉,都想着转换到opencv进行show.本文介绍一下两种开源库中rectangle类型之间的转换. 类型说明 ...
- JSON字符串和JS对象之间的转换
JSON字符串和JS对象之间的转换 1 json字符串转换为js对象 1.1 标准json格式字符串转换为Js对象 JSON字符串 str JSON.parse(str) eval(str) eva ...
- C# Stream 和 byte[] 之间的转换
一. 二进制转换成图片 MemoryStream ms = new MemoryStream(bytes); ms.Position = ; Image img = Image.FromStream( ...
- Java基础——基本类型和包装类、基本类型和字符串之间的转换
基本类型和包装类之间的转换 基本类型和包装类之间经常需要互相转换,以 Integer 为例(其他几个包装类的操作雷同哦): 在 JDK1.5 引入自动装箱和拆箱的机制后,包装类和基本类型之间的转换就更 ...
- String类型和基本数据类型之间的转换
Java 中基本类型和字符串之间的转换 在程序开发中,我们经常需要在基本数据类型和字符串之间进行转换. 其中,基本类型转换为字符串有三种方法: 1. 使用包装类的 toString() 方法 2. 使 ...
随机推荐
- 牛客寒假6-G.区间或和
链接:https://ac.nowcoder.com/acm/contest/332/G 题意: 求a|(a+1)|(a+2)|...|(b-1)|b. 思路: 求a-b的差的每一个二进制位 自己也看 ...
- centos6.7版本下配置ssh密钥登录
需要提前说明的是我使用的系统是centos6.7的版本. 1.我使用的是Putty登录 #ssh-keygen (生成公钥和私钥的命令) 回车之后会提示密钥要存放的目录,默认的目录是当前目录下的.ss ...
- python入门之生成器
生成器 通过列表生成式,可以直接创建一个列表,但是,受到内存限制,列表容量肯定是有限得.而且,创建一个包含100万个元素的列表,不仅占用很大的存储空间,如果仅仅需要访问前面几个元素,那后面绝大多数元素 ...
- Haproxy常见用法
简介 HAProxy 提供高可用性.负载均衡以及基于 TCP 和 HTTP 应用的代理,支持虚拟主机, 它是免费.快速并且可靠的一种解决方案. HAProxy 特别适用于那些负载特大的 web 站点, ...
- Rabbitmq~linux环境的部署
之前写过在windows环境上部署rabbitmq,这回介绍在centos上对这个消息中间件进行部署的过程 一 下载和解压 wget http://www.rabbitmq.com/releases ...
- Gridview基础
gridview是封装好的,直接在设计界面使用,基本不需要写代码 1.绑定数据源 GridView最好与LinQDatasourse配合使用,相匹配绑定数据: 2.外观控制—— 点开有自动套用格式 布 ...
- {g2o}Installation Notes:ccmake
main reference: http://www.cnblogs.com/gaoxiang12/p/3776107.html "注意libqglviewer-qt4-dev只在ubunt ...
- MySQL的information_schema的介绍(转)
转自:http://www.cnblogs.com/hzhida/archive/2012/08/08/2628826.html, 大家在安装或使用MYSQL时,会发现除了自己安装的数据库以外,还有一 ...
- SAP成都研究院飞机哥:程序猿和飞机的不解之缘
今天的文章来自Jerry的老同事张航. 张航和Jerry一样于2007年毕业后加入SAP成都研究院工作至今.进入SAP后的第一个开发部门是SAP Business by Design Infrastr ...
- asp.net mvc集成log4net
第一步:在web项目的引用中添加log4net.dll,可以通过Nuget直接下载并安装: 第二步:在web项目的web.config配置文件的configuration节点内添加log4net节点, ...