knnMatch() returning strange match counts and indices
In the match object populated by knnMatch() (K=1, either unique or not) I get strange pattern of match counts for each entry returned - the counts order is typically [x, y, 7, 8, x, y, 7, 8, ...] (x/y typically 0 or 1 which make sense). Once in a while wild numbers (e.g. 8521267) are set there.
In addition, the indices of the first matches are also often wild numbers, built from 0xEEEEEEEE/0xABABABAB/0xCDCDCDCD, which seem to indicate they point to some wrong heap areas.
I include a snapshot of the compact returned values from VS 2012 and the test code I used, still before meaningful code has been run.
Hope someone can explain this, point to something wrong I did, or is that a real bug? Any workaround in this case?
I was also suspecting a possible incompatibility between STL versions between my build and the OpenCV library, but I didn't see such issues when searching.
This happens with 2.4.6
--- Returned values --- - matches { size=128 } ::vector<std::vector<cv::DMatch,std::allocator<cv::DMatch> >,std::allocator<std::vector<cv::DMatch,std::allocator<cv::DMatch> > > > [size] 128 __int64 [capacity] 128 __int64 + [0] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [1] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [2] { size=7 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [3] { size=8 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [4] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [5] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [6] { size=7 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [7] { size=8 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [8] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [9] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [10] { size=7 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [11] { size=8 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [12] { size=0 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [13] { size=0 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [14] { size=7 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [15] { size=8 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [16] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [17] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [18] { size=7 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [19] { size=8 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [20] { size=0 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [21] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [22] { size=7 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [23] { size=8521267 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [24] { size=0 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > + [25] { size=1 } std::vector<cv::DMatch,std::allocator<cv::DMatch> > ...--- Test Function (based on sample code) --- #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include "opencv2 ...