convert Matrix of type CV_32FC1 to CV_64FC1

Okay, I’m a dimwit. Here is how it goes:

There is the function convertTo that does exactly what I want.

Thanks for matrix type conversion in opencv for pointing this out.

Here is how I do it:

cv::Mat A = loadMat("mymat.xml"); // See function loadMat in the question!
A.convertTo(A, CV_64F);

Leave a Comment