1 | initial version |
knnMatch outputs the list of k nearest neighbours as a vector<vector<dmatch>>. It means that for each feature in the query image, it will output k (or less) DMatch, hence the need for a 2D structure.
If you only need 1 neighbour for each query image feature, you can use the .match() method, with the output as a vector<dmatch>.