When we used the surf feature of opencv2.3.1 for feature point matching yesterday, we found that the drawmatches function is always faulty, and the exception prompt is vector overflow? I can't explain why others are using it well. When it comes to me, It overflows. Why ??!!!
Today, I carefully studied the opencv manual and finally found the problem. When I used flannbasedmatcher to perform the match function matching, I did not pay attention to the sequence: the first parameter of matcher is the query feature description sub, the second is the train feature description child. In this way, the generated match corresponds to dmatch. When the drawmatches function is used later, keypoints1 corresponds to the feature points of the query sub-statement, keypoints2 corresponds to the train description sub, so that the matches1to2 parameter 5 can correctly match and find the corresponding matching point.
At the beginning, I did not take a closer look at the parameter explanation. I passed the description to the function and reversed it. The result must be a vector overflow when I used dmatch to search for matching points.
-------------- I learned something again!