How vector from an xml file with FileStorage Opencv API [closed]
Hello everyone,
I am having issues read vector of matching scores from an xml file using the filestorage API in opencv c++.
When the code starts running it never stops. Just keeps ongoing. I suspect there is something wrong with an iteration somewhere but i dont know where. Here is my code for reading the scores:
void readFileNodeList(const FileNode& fn, vector<double>& result)
{
if (fn.type() == FileNode::SEQ) {
for (FileNodeIterator it = fn.begin(); it != fn.end();) {
double item;
it >> item;
result.push_back(item);
}
}
}
/*Reads a vector of Matching scores from the xml file*/
void ReadScores(string filename,vector<vector<double>> Mvector){
FileStorage fs(filename, FileStorage::READ);
string element;
vector<double> value;
FileNode n = fs["score"];
for (int i = 0; TestLabels.size(); i++){
element = "s" + to_string(i);
FileNode tempID = n[element];
readFileNodeList(tempID, value);
Mvector.push_back(value);
value.clear();
}
fs.release();
}
Here is my xml file:
Please help.....
Sorry guys my error. its in the condition of the for loop.