Save MAT without header
Hi,
I am using FileStorage to write out Mat object (in my case it's a depthMap from Kinect). FileStorage either saves it as XML or YAML with headers. I tried using 'for loop' to save only the data, but its time consuming. Is there a way where I can save only the data of MAT object directly in a file without the headers?
Thanks.
if you want to reconstruct a Mat from that, you'll probably need the header information. if you don't, you can write similar to cout << img << endl;
you can try file operation using fstream header. open a file and write into it as fout<<img;
@berak@jamesnzt - I have tried that cout (fout) operation to write the MAT in the file. But it still saves it in a YAML format with first two lines as header and then a field called data which contains the values. I just want to write the values in a file. It seems OpenCV can only save it as YAML or XML format.
i don't see your problem:
Mat m = Mat::eye(3,3,0);
cerr << m << endl;