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 :)
cv::Mat
is the new type introduce in OpenCV2.X while the IplImage*
is the "legacy" image structure.
Although, cv::Mat
does support the usage of IplImage
in the constructor parameters, the default library does not provide function for the other way. You will need to extract the image header information manually. (Do remember that you need to allocate the IplImage structure, which is lack in your example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With