Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion from IplImage* to cv::MAT

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


2 Answers

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.
like image 104
Moein Avatar answered Sep 12 '25 20:09

Moein


here is a good solution

Mat(const IplImage* img, bool copyData=false);
like image 41
Houssem Badri Avatar answered Sep 12 '25 18:09

Houssem Badri