Saving matrix in double precision from OpenCV (C ++) for Matlab

I want to compare matrices created from OpenCV with those in Matlab. If the matrices are uint8, saving them as pgm images will do the trick. But my matrices are CV_64FC1 (double), which cannot be saved as images. Is there an easy way to save my dual matrix for reading in matlab?

+4
source share
2 answers

Try this from OpenCV samples.

Mat r std::stringstream ss; ss << format(r,"csv") << endl << endl; myFile << ss.str(); // or even this myFile << format(r,"csv") << endl << endl; 
+8
source

Just write the intensity of each pixel to a file and read it with MATLAB with importdata .

0
source

Source: https://habr.com/ru/post/1437426/


All Articles