Converting cv::Mat to IplImage*

Posted by amr on Stack Overflow See other posts from Stack Overflow or by amr
Published on 2011-01-12T00:20:47Z Indexed on 2011/01/12 1:53 UTC
Read the original article Hit count: 640

Filed under:
|

The documentation on this seems incredibly spotty.

I've basically got an empty array of IplImage*s (IplImage** imageArray) and I'm calling a function to import an array of cv::Mats - I want to convert my cv::Mat into an IplImage* so I can copy it into the array.

Currently I'm trying this:

while(loop over cv::Mat array)
{
    IplImage* xyz = &(IplImage(array[i]));
    cvCopy(iplimagearray[i], xyz);
}

Which generates a segfault.

Also trying:

while(loop over cv::Mat array)
{
    IplImage* xyz;
    xyz = &array[i];
    cvCopy(iplimagearray[i], xyz);
}

Which gives me a compile time error of: error: cannot convert ‘cv::Mat*’ to ‘IplImage*’ in assignment

Stuck as to how I can go further and would appreciate some advice :)

© Stack Overflow or respective owner

Related posts about c++

Related posts about opencv