4

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?

Tae-Sung Shin
  • 19,749
  • 32
  • 136
  • 235

2 Answers2

8

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;
Sam
  • 19,280
  • 4
  • 55
  • 81
0

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

Jacob
  • 33,685
  • 14
  • 109
  • 164