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);