Problem
Tried to compile some code that uses OpenCV and got this error:
foo.cpp:268:27: error: no matching function for call to βcv::Mat::Mat(IplImage*&)β
The code at that error line tries to construct a cv::Mat object from IplImage:
void boohoo(IplImage* i) { // ... abracadabra(cv::Mat(i)); // ... }
Solution
It turns out this code worked in older versions of OpenCV. But with recent versions of OpenCV, this cv::Mat constructor is no longer present.
Instead, the conversion has to be performed using a cv::cvarrToMat function:
void boohoo(IplImage* i) { // ... abracadabra(cv::cvarrToMat(i)); // ... }
Tried with: OpenCV 2.4.9 and Ubuntu 12.04 LTS