Mat转IplImage
Mat Img=imread("1.jpg");
IplImage* pBinary = &IplImage(Img);//浅拷贝
IplImage *input = cvCloneImage(pBinary);//深拷贝只要再加一次复制数据
IplImage img = IplImage(mat);
IplImage转Mat
IplImage* src = cvLoadImage("1.jpg", 0);
Mat img = cvarrToMat(src);//把二值化后的src转换为Mat类型
-
IplImage* image = cvLoadImage( "lena.jpg");
-
Mat mat=cvarrToMat(image);
IplImage img = IplImage(mat);
//IplImage—>Mat
//EXAMPLE:
//浅拷贝:
IplImage* pBinary=cvLoadImage("c://temp.jpg",0);
Mat Img;
Img=cvarrToMat(pBinary);
//深拷贝只需要再在Mat里创建一个新的Mat对象,然后进行数据的复制,再用上述的函数进行数据头的复制(浅拷贝):
IplImage* pBinary=cvLoadImage("c://temp.jpg", 0);
Mat ImgTemp;
Img=cvarrToMat(pBinary);
Mat Img = ImgTemp.clone();
//Mat—>IplImage
//EXAMPLE:
//浅拷贝:
Mat Img=imread("1.jpg");
IplImage* pBinary = &IplImage(Img);
//深拷贝只要再加一次复制数据:
IplImage *input = cvCloneImage(pBinary);