Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you will need "nested" FileNodeIterators for this, one for the "features" node, and one for each "lbp" node:

FileStorage fs("test.yml",0);
FileNode features = fs["features"];
FileNodeIterator it = features.begin();
for (; it != features.end(); ++it)
{
    int x,y;
    (*it)["x"] >> x;
    (*it)["y"] >> y;
    cerr << "xy " << x << " " << y << endl;
    FileNode lbp = (*it)["lbp"];
    FileNodeIterator it2 = lbp.begin();
    for (; it2 != lbp.end(); ++it2)
    {
        int a,b;
        (*it2)["a"] >> a;
        (*it2)["b"] >> b;
        cerr << " ab " << a << " " << b << endl;
    }
}

// output:
xy 103 166
 ab 43 56
 ab 23 87
 ab 45 34
xy 115 113
 ab 76 54
 ab 42 2
 ab 64 14
xy 586 12
 ab 6 45
 ab 34 34
 ab 87 34