opencv2的头文件:
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <stdio.h>
1、Mat转 IplImage :
好多博客都写到了这样一句,我看了觉得没毛病啊
Mat dst;
IplImage *qImg = &(IplImage)dst
出现报错:Taking the address of a temporary object of type 'IplImage' (aka '_IplImage')
原因:&(IplImage)dst1操作取了临时变量的地址。返回后临时变量已经“消失”了,你不能再使用了。所以报错
IplImage src = cvIplImage(image);
2、IplImage* 转 Mat :
IplImage* src = 0;
Mat image = cvarrToMat(src);
亲测可行