将cv::Mat转为IplImage

来源:互联网 发布:群发短信软件免费版 编辑:程序博客网 时间:2024/05/17 03:41

回答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.


原创粉丝点击