How to convert a Mat variable type in an IplImage variable type in OpenCV 2.0?

前端 未结 4 1762
别跟我提以往
别跟我提以往 2020-12-10 04:22

I am trying to rotate an image in OpenCV.

I\'ve used this code that I found here on Stack Overflow:

Mat source(img);
Point2f src_center(source.cols/2         


        
4条回答
  •  自闭症患者
    2020-12-10 04:58

    For having the whole IplImage object, I've used this code:

    Mat matImage;
    IplImage* iplImage;
    
    iplImage = cvCreateImage(cvSize(640,480), IPL_DEPTH_8U, 1);
    iplImage->imageData = (char *) matImage.data;
    

    You can also copy the data instead of pointer:

    memcpy(iplImage->imageData, matimage.data, 640*480);
    

提交回复
热议问题