Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When loading KeyPoint from XML, the class_id is lost

Hello all,

When I use point extractor (specifically I use AKAZE but it is similar to SIFT) I use the FileStorage to save it in a .XML file. After I extract the points, I manually give each point a class_id. Later on I save it in a xml file. After it is saved, I look at the xml file and everything is saved correctly. Then I try to load it and everything loads correctly except the class_id. I manually checked everything and only the class_id is wrong. Not only it is wrong but far exceeds the limits of a int (which the class_id is). For example

  • I saved class_id = 1 and when I load it I get class_id = 1065353216
  • I saved class_id = 2 and when I load it I get class_id = 1073741824
  • I saved class_id = 3 and when I load it I get class_id = 1077936128

Here is the code of how I load it

vector<KeyPoint> temp_kpts;
FileStorage fs("Myfile.xml", FileStorage::READ);
fs["KeyPoints_1"] >> temp_kpts;
cout<<"KeyPoitn ID is --> "<< temp_kpts[0].class_id <<endl;
cout<<"KeyPoitn ID is --> "<< temp_kpts[1].class_id <<endl;
cout<<"KeyPoitn ID is --> "<< temp_kpts[2].class_id <<endl;
fs.release();

Does anybody know what is going on?