I do have a problem with the reading of the objects, stored in the yaml format. As you see (below) I store a std::vector which contain some Limbs which hold a cv::Point, a Probability, Validity and the Id of itself.
person:
- Nose
-
Point: [ 0, 0 ]
Proba: 0.
IsValid: 0
LimbId: 0
- Neck
-
Point: [ 0, 0 ]
Proba: 0.
IsValid: 0
LimbId: 1
person:
...
The store function looks like this and seems to work due to the file output:
void person::write(cv::FileStorage & fs)
{
for (int limbIndex = 0; limbIndex <= 17; limbIndex++) {
fs << getLimbName(limbIndex) << "{";
fs << "Point" << getLimb(limbIndex).point;
fs << "Proba" << getLimb(limbIndex).probability;
fs << "IsValid" << getLimb(limbIndex).isValid;
fs << "LimbId" << getLimb(limbIndex).limbId;
fs << "}";
}
}
Unfortunately I m quite unsure how to read the yaml file back, since it contains a list of persons with a list of limbs inside. The best way which I read from it seems to be the FileNodeIterator from : yaml persistence.
So far I would do this :
cv::FileNode personEntries = fileStorage["person"];
cv::FileNodeIterator it = personEntries.begin(), it_end = personEntries.end();
for (; it != it_end; ++it, idx++) {
// should now have one person from the yaml file
}
How do I get the Limbs located in a person also as FileNodeIterator? And how can I read cv::Point from a cv::FileNode?
Thanks for your help!