Conversion from IplImage* to cv::MAT

user1807367 picture user1807367 · Apr 10, 2013 · Viewed 59.6k times · Source

I searched to convert an IplImage* to Mat, but all answers were about the conversion to cvMat.

How, can I do it? and what is the difference between Mat and cvMat?

Thanks in advance

Answer

Moein picture Moein · Jun 15, 2015

For the records: taking a look at core/src/matrix.cpp it seems that, indeed, the constructor cv::Mat(IplImage*) has disappeared.

But I found this alternative:

IplImage * ipl = ...;
cv::Mat m = cv::cvarrToMat(ipl);  // default additional arguments: don't copy data.