opencv3.0 IplImage* 与Mat 格式相互转换

来源:互联网 发布:淘宝怎么传宝贝视频 编辑:程序博客网 时间:2024/06/06 00:55

在opencv2.4.9 下有如下这样的代码
IplImage * ipl1, *ipl2;
const cv::Mat m1 = cv::Mat(ipl);
cv::Mat m2 = ipl2;
但是在opencv3.0 下上面的代码在编译的时候会出现错误。
应该修改为:
cv::Mat m1 = cv::cvarrToMat(ipl);
cv::Mat m2 = cv::cvarrToMat(ip2);

但是Mat 转为iplimage * 没有变。
Mat mat1,mat2;
IplImage* ip1= &mat1;
IplImage* ip2= &mat2;

原创粉丝点击