Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Though as already said this is not a real OpenCV question/answer, rather more a C++ one, I leave it here my easy function to save matrices as .csv files (comma separated values), which can be opened as Excel sheets

#include <fstream>

void saveMatToCsv(Mat &matrix, string filename){
    ofstream outputFile(filename);
    outputFile << format(matrix, "CSV") << endl;
    outputFile.close();
}

Though as already said this is not a real OpenCV question/answer, rather more a C++ one, I leave it here my easy function to save matrices as .csv files (comma separated values), which can be opened as Excel sheetssheets. This is what I use inside my OpenCV code, so it should work for you too

#include <fstream>

void saveMatToCsv(Mat &matrix, string filename){
    ofstream outputFile(filename);
    outputFile << format(matrix, "CSV") << endl;
    outputFile.close();
}