I am trying to write a mat file to txt file. I am using the above function to do so:
void writeMatToFile(cv::Mat& m, const char* filename){
ofstream fout(filename);
for(int i=0; i<m.rows; i++){
for(int j=0; j<m.cols; j++){
fout<<m.at<float>(i,j)<<"\t";
}
fout<<endl;
}
fout.close();
}
And the main code:
string file = "output.txt";
writeMatToFile(image,file.c_str());
However I am receiving unhandled exceptions. Any idea how can i store mat data in txt?