0

How to convert from c++ interface cv::Mat to c IplImage ? such that i used
IplImage * lpl= matimage;

and matimage contain data and after some operation i want to do inverse convert. from IplImage* lpl ===> cv::Mat can i use a copy data and how ?

  • possible duplicate of [How to convert a Mat variable type in an IplImage variable type in OpenCV 2.0?](http://stackoverflow.com/questions/2468307/how-to-convert-a-mat-variable-type-in-an-iplimage-variable-type-in-opencv-2-0) – karlphillip Sep 10 '12 at 18:07

2 Answers2

2
cv::Mat img = ....;
IplImage iplImg = img;

Then

cv::Mat img2(iplImg);
juanchopanza
  • 223,364
  • 34
  • 402
  • 480
0
#include "iostream"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main()
{
    Mat image = imread("C:\\lena.jpg");
    IplImage image2 = image;
    cvShowImage("TESTiplimage",&image2);
    imshow("TESTmat",image);
    waitKey(0);

    return 0;
}

...try this code it...it works for me...you should get 2 windows showing the same image..

rotating_image
  • 3,046
  • 4
  • 28
  • 46