The FlannBasedMatcher.match()
method does not do what you think it does; it will return the best match for every keypoint. As such, you will always have 163 matches because there will always be a best match, even if it is not a very good one.
What usually happens when matching features is that a threshold is then applied to the descriptor distances; so for example, if any of the matches have a distance greater than threshold t
, then they are rejected. The number of good matches, after thresholding, is usually used to measure the similarity between images. I think this is the number you were expecting to get.
Your code basically forms the first part of the tutorial here. If you read the tutorial you will see exactly what I have described, where the matches are thresholded according to their distance.