Writing Mat to FileStorage: is there a way to format the output?

asked 2015-06-10 10:01:12 -0500

I'd like to be able to read the output of FileStorage more easily, so is there a way to change the format? Something like, e.g., newlines on rows, tabs on columns.

edit retag flag offensive close merge delete

Comments

Why would you like to do that?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-06-10 10:20:27 -0500 )edit

I work with a lot of transform matrices, and I'd like to be able to quickly read them. Currently FileStorage puts newlines after a certain amount of characters, it seems like, but this makes it hard to see the rotation component, translation component, etc. I mean, I could just print it out to a file myself, but since I'm using FileStorage anyway,..

fl1p234 gravatar imagefl1p234 ( 2015-06-10 23:49:46 -0500 )edit
2

I suppose that FileStorage is doing so because OpenCV is for working on images and other type of data, like descriptors or machine learning files; so imagine a yml or xml containing 10 or 20 lines of more than 256 elements... IMHO FileStorage is ok for storing the Mat object, but if you want to see them, then you can read the file and print (std::cout << mat << std::endl;) the Mat so you can see it.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-06-11 02:17:51 -0500 )edit
1

Thanks! I ended up doing this, but to an ofstream instead.

fl1p234 gravatar imagefl1p234 ( 2015-06-11 06:10:51 -0500 )edit