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. 使 ...
随机推荐
- Java的Cloneable接口还有深浅复制
我的小记录 首先语法上,搞清除,Java有个Cloneable接口,但这个接口是没有定义方法的. 那实现了这个接口有什么用呢? 再看Object类中,有个clone()方法,这个方法提供一个浅复制的功 ...
- python 多继承(新式类) 二
在python中,要调用父类的某个方法,python2.2之前需要如下代码: class A:def __init__(self): print "enter A" pri ...
- 如何理解linux多用户多任务
Linux 的单用户.多任务: 容易理解. Linux 的多用户.多任务 举个例子,比如LinuxSir.Org 服务器,上面有FTP 用户.系统管理员.web 用户.常规普通用户等.在同一时刻,比如 ...
- C# winwordcontrol控件编程
C# word控件WinWordControl可创建.编辑.保存word. 1.使用代码直接创建word文件,同时可以添加页眉.内容.图片及表格,示例代码: /// <summary> ...
- [问题记录]Ubuntu下chmsee安装失败的解决
日期:2016年2月26日 一直在找Ubuntu下查看chm的工具但是普遍不理想,发现在deepin中的chmsee相对比较好,但是直接执行网上的sudo apt-get install chmsee ...
- Django分组查询
先补充两个知识点: 1.group by 大前提:可以按照任意字段分组,但是最好是按照分辨度比较低的来分组(重复比较多的分辨度比较低). group by分组可以单独使用,不搭配其他条件. 分组的字段 ...
- jQuery.Deferred(jQuery1.5-2.1)源码剖析
jQuery.Deferred作为1.5的新特性出现在jQuery上,而jQuery.ajax函数也做了相应的调整.因此我们能如下的使用xhr请求调用,并实现事件处理函数晚绑定. var promis ...
- react项目构建中的坑—淘宝镜像安装后要设置
基本的搭建步骤参考博客:https://blog.csdn.net/qq_27727251/article/details/86593415 这里要强调的坑是:安装完淘宝镜像要将其设置为默认Regis ...
- git clone fatal: unable to access 'https://github.com/carlon/demo.git/': Failed to connect to github.com port 443: Timed out
$ git config --global http.proxy $ git config --global --unset http.proxy 虽然之前没有设置代理,但是不知道为什么执行以上代码之 ...
- LR中webservice服务测试的脚本
Action(){ /* 测试QQ是否在线的功能接口 输入参数:QQ号码 String,默认QQ号码:8698053. 返回数据:String,Y = 在线:N = 离线:E = QQ号码错误:A = ...