Apart from the specific functions to read and write images and video, in OpenCV, there is a more generic way to save/load the data. This is referred to as data persistence: the value of objects and variables in the program can be recorded (serialized) on the disk. This can be very useful to save results and load the configuration data. The main class is the aptly named
FileStorage, which represents a file on a disk. Data is actually stored in XML or YAML formats.
These are the steps involved when writing data:
FileStorageconstructor, passing a filename and a flag with the
FileStorage::WRITEvalue. The data format is defined by the file extension (that is,
<<operator to write data to the file. ...