When loading KeyPoint from XML, the class_id is lost [closed]
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?
There is abug in opencv. you can read this post (first answer and comments)
@LBerger Is there some bug report ?
@Metalzero2 I cannot retrieve it. @berak Is it same Bug?
Do you have these line in the xml file
<opencv_storage> <cascade> <stagetype>BOOST</stagetype> <featuretype>SIFT</featuretype> ....... and a few other line after this ??
If you don't then you don't have the correct format of this XML file. So if you need to have an idea about these lines open any xml file of those present in opencv directory where you extracted it, and read the syntax, you may find some interesting.
@tes using this :
I have got :
**
**
<opencv_storage> <cascade type_id="opencv-cascade-classifier"><stagetype>BOOST</stagetype> <featuretype>SIFT</featuretype> <height>24</height> <width>24</width> <stageparams> <maxweakcount>211</maxweakcount></stageparams> <featureparams> <maxcatcount>0</maxcatcount></featureparams> <stagenum>25</stagenum> <stages>
This is how it should look like. To be honest I have not used AKAZE yet, but try what I wrote, it may help you