O'Reilly logo

Learning Image Processing with OpenCV by Gloria Bueno García, Oscar Deniz Suarez, José Luis Espinosa Aranda, Jesus Salido Tercero, Ismael Serrano Gracia, Noelia Vállez Enano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data persistence

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:

  1. Call the FileStorage constructor, passing a filename and a flag with the FileStorage::WRITE value. The data format is defined by the file extension (that is, .xml, .yml, or .yaml).
  2. Use the << operator to write data to the file. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required