Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

opencv

matlab

I want to compare matrices created from OpenCV with the ones in Matlab. If the matrices are uint8, Saving them as pgm images would do the trick. But my matrices are CV_64FC1 (double) that can't be saved as images. Is there any easy way to save my double matrix for reading in Matlab?

like image 350
Tae-Sung Shin Avatar asked Feb 19 '23 23:02

Tae-Sung Shin


1 Answers

Try this one 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;
like image 190
Sam Avatar answered May 24 '23 04:05

Sam