OpenCV:IplImage, CvMat, Mat 相互转换

cv::Mat

Mat转IplImage:http://blog.csdn.net/yanzi1225627/article/details/18518793

cv::Mat preMat;
//第一种转换方式
IplImage imgIpl1 = preMat;
//第二种转换方式  
IplImage imgIpl2 = preMat.operator IplImage();
//IplImage imgIpl2=IplImage(preMat);
//第三种转换方式  
IplImage imgIpl3 = (IplImage)(preMat);

http://blog.csdn.net/wuxiaoyao12/article/details/7305848

Mat转CvMat:

CvMat imgCMat= preMat

 

CvMat

CvMat转Mat:

Mat::Mat(const CvMat* m, bool copyData=false);

CvMat转IplImage:

利用IplImage* cvGetImage( const CvArr* arr, IplImage* image_header )

 

IplImage

IplImage转Mat

Mat::Mat(const IplImage* img, bool copyData=false);

IplImage转CvMat

法1:CvMat mathdr, *mat = cvGetMat( img, &mathdr );
法2:CvMat *mat = cvCreateMat( img->height, img->width, CV_64FC3 );
         cvConvert( img, mat );


IplImage*转 BYTE*
BYTE* data= img->imageData;

你可能感兴趣的:(opencv,IplImage,CvMat,cv::Mat)