## FileStorage module (YML)

One of the most useful things OpenCV has is YML file library. I canno't believe have easy to use they are. Before I learned this, I was making complicated algorithms and writing array of data like detected keypoints or descriptrs in "txt" file. But there is much simpler solution...

It's pretty straight forward how to use the FileStorage module in OpenCV, I don't think after showing the code snippets I need to explain anything.

Maybe if you don't know the concept of yml or xml files you should go here: http://en.wikipedia.org/wiki/YAML

Ok let's get down to bussiness!

To write array of data into yml file:

fileString = "keypoints.yml";
cv::FileStorage fs(fileString, cv::FileStorage::WRITE);

write(fs,"keyPointsSURF", keypointsSURF);
fs.release()

And to access the data you do it like this:

fs.open("keypoints.yml", FileStorage::READ);
if(fs.isOpened())
{
}
fs.release();

Just a note:

The "read" command can be swapped with these lines, I personally prefer the "read" method

fs["descriptorsSURF"] >> descriptorsSURF;
fs["keyPointsSURF"] >> keypointsSURF;

### Related Articles

• #### Implementing pulse oximeter using MAX30100

Mar 8, 2017 | by Raivis Strogonovs
• #### nRF51 Makefile with Qt Creator

Jun 4, 2016 | by Raivis Strogonovs
• #### USART, FreeRTOS and C++ on nRF51

Dec 14, 2015 | by Raivis Strogonovs
• #### Starting with nRF51 BLE and Qt Creator

Dec 12, 2015 | by Raivis Strogonovs
• #### Touch gesture recognition using body capacitance

Nov 29, 2014 | by Raivis Strogonovs
• #### Introduction to data encryption

Oct 4, 2014 | by Raivis Strogonovs
• #### MEMS (Part 2) – Guide to using gyroscope L3G4200D

Jun 17, 2014 | by Raivis Strogonovs
• #### DJXIA in Implementing pulse oximeter using MAX30100

same problem here

#### Fabian Rios in Implementing pulse oximeter using MAX30100

I Sorry, when I click on "Submit Comment" say me error, and I try again, try again... I sorry for the replies

#### Fabian Rios in Implementing pulse oximeter using MAX30100

Hi Raivis or some person, I download all inside the folder with the .ino ok but de led of my board no go on, the monitor put all the time 19:58:20.999 ->  2debug=true...

#### Fabian Rios in Implementing pulse oximeter using MAX30100

Hi Raivis or some person, I download all inside the folder with the .ino ok but de led of my board no go on, the monitor put all the time 19:58:20.999 ->  2debug=true...

#### Fabian Rios in Implementing pulse oximeter using MAX30100

Hi Raivis or some person, I download all inside the folder with the .ino ok but de led of my board no go on, the monitor put all the time 19:58:20.999 ->  2debug=true...

#### Fabian Rios in Implementing pulse oximeter using MAX30100

Hi Raivis, or some person, I download all inside the folder with the .ino ok but de led of my board no go on, the monitor put all the...

#### Epson printer error code 0xf1 in nRF51 Makefile with Qt Creator

This is a very good post which I really enjoy reading. It is not every day that I have the possibility to see something like this. Epson printer error code...