Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Confusion over FileStorage syntax

$
0
0
Hallo friends, I'm confused over how to use `FileStorage` in order to write a sequence of mappings to a file. Here's an example: vector> vec; // holds results of video analysis // append pairs to vec... FileStorage fs(file, FileStorage::WRITE); fs << "Positions" << "["; for (Result::iterator i = vec.begin(); i != vec.end(); ++i) { fs << "{" << "Frame" << (int)i->first<< "X" << i->second.x << "Y" << i->second.y << "}"; } fs << "]"; When I'm running the above code I trigger the following `CV_Error` (persistence.hpp:1064): if( fs.state == FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP ) CV_Error( Error::StsError, "No element name has been given" ); While trying to write the first element of the mapping. Of course I've checked the docs (see: [http://docs.opencv.org/modules/core/doc/xml_yaml_persistence.html](http://docs.opencv.org/modules/core/doc/xml_yaml_persistence.html)) but was suprised to see, that they basically do the exact same thing there. Have they changed the syntax in OpenCV3.0 or am I overlooking something here? I've already recompiled the current master branch (`faa6684`) prior to cleaning the build directory. I'm running a Win 7 x64 with VS2012 as a compiler. Many thanks, Viktor

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>