IplImage、IplImage、Mat之间的转换

IplImage是OpenCV中C语言的图像类型;

cv::Mat是OpenCV中C++语言的图像类型;

 

一、Mat—>IplImage

Mat image;

if(!image.data)

{

cout<<“Could not open or find the image”<

return -1;

}

 //convert to IplImage  

IplImage ipl_img(image); 

 

 

二、 Mat—>IplImage*

 

   IplImage *frame;

   Mat Img;

   frame=&IplImage(Img);//*frame=IplImage(Img);

 

三、IplImage*—>Mat

IplImage* iplimg = cvLoadImage("heels.jpg");

Mat matImg;

matImg = Mat(iplimg);



你可能感兴趣的:(OpenCV)