回答1:
It does provide a conversion to IplImage, creating a header without copying the data. So IplImage* img = new IplImage(mat);
should work.
回答2:
Actually, you can do this: IplImage iplimg = mat;
and just use &iplimg
wherever you need anIplImage
. There is no need for dynamic allocation.
回答3:
In the new OpenCV 2.0 C++ interface it's not really necessary to change from back and forth betweenMat
and IplImage
, but if you want to you can use the IplImage
operator:
IplImage dst_img = dst;
Note that only the IplImage header is created and the data (pixels) will be shared. For more info see theOpenCV C++ interface or the image.cpp
example in the OpenCV-2.0/samples/c
directory.