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

Geeting error while reading the xml file.

$
0
0
Hi , I am getting the error while reading the xml file. The error message is.."duplicate key". I have attached read and write function and screenshot of xml file.![image description](/upfiles/15187733094949328.png) thank you. int main() { std::vector names = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; cv::FileStorage fs("FeatureVector.xml", cv::FileStorage::WRITE); superpixelSlic.writeVector(fs, names, tempCenters); fs.release(); vector readTempCenters; std::vector nm = { "SuperPixelno", "lValue", "aValue","bValue","xCenter","yCenter","depthValue" }; FileStorage fs2("FeatureVector.xml", FileStorage::READ); readVector(fs2, nm, readTempCenters); fs2.release(); return (0); } void readVector(FileStorage &fns, vector nm, vector&data) { data.clear(); CenterValues tmp; FileNode fn = fns["features"]; if (fn.empty()) { return; } for (FileNodeIterator current = fn.begin(); current != fn.end(); ++current) { //FileNode item = *current; cout << "superpixelno. " << (double)(*current)[nm[0]]; cout << "light Value " << (double)(*current)[nm[1]]; cout << "a value" << (double)(*current)[nm[2]]; cout << "b value" << (double)(*current)[nm[3]]; cout << "x Value" << (double)(*current)[nm[4]]; cout << "y Value" << (double)(*current)[nm[5]]; cout << "depth Value" << (double)(*current)[nm[6]]; } } void SuperpixelSlic:: writeVector(cv::FileStorage &fs, std::vector&names, std::vector&data) { for (int i = 0; i < data.size(); i++)![image description](/upfiles/1518773204719258.png) { fs << "features"; fs <<"{:"<< names[0] << i<

Viewing all articles
Browse latest Browse all 4615

Trending Articles



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