I found the answer thanks to @SchighSchagh.
It is necessary to iterate through the node with a cv::FileNodeIterator
and cast it later to a cv::FileNode
. The key is then stored as the name of this cv::FileNode
:
cv::FileStorage fs("file.yaml.gz", cv::FileStorage::READ);
cv::FileNode fn = fs["mymap"];
for(cv::FileNodeIterator fit = fn.begin(); fit != fn.end(); ++fit)
{
cv::FileNode item = *fit;
std::string somekey = item.name();
double someval = (double)item;
...
}
It is important to realize that the notation fit->name()
does not work with a cv::FileNodeIterator
.