-1
Mat m = Mat(4, 4, CV_8UC3);
IplImage * iplImage = cvIplImage(m);

error: cannot convert ‘_IplImage’ to ‘IplImage*’ {aka ‘_IplImage*’} in initialization

opencv 4.5.3 ubuntu 20.04

Ranoiaetep
  • 5,872
  • 1
  • 14
  • 39
david129
  • 13
  • 2
  • 1
    You don’t. `IplImage` is gone, dead, defunct, never to return. There is no support in OpenCV 4. Do not use it. – beaker Mar 21 '22 at 04:21
  • 1
    Have a look at the intel performance library reference manual. Fill the IplImage header with mat.data, size and widthStep and use ipl functions to deep copy the data if necessary. – Micka Mar 21 '22 at 06:41
  • Have a look here: https://stackoverflow.com/questions/4664187/converting-cvmat-to-iplimage – wohlstad Mar 21 '22 at 11:08
  • @wohlstad Do any of the solutions suggested there actually work in OpenCV 4? – beaker Mar 21 '22 at 17:40

1 Answers1

0

In opencv 4.5 there is still a ctor of IplImage that takes a cv::Mat. There is also a function cvIplImage to convert cv::Mat to IplImage.

However - as you can see in ...\include\opencv2\core\types_c.h, some code is only available if you compiled opencv with the proper flags (e.g. CV__ENABLE_C_API_CTORS for the IplImage ctor).

wohlstad
  • 12,661
  • 10
  • 26
  • 39