anon
anon

Reputation:

knnMatch requires k>1 to get good results?

I am using SURF and i am trying both

FlannBasedMatcher

and

BruteForceMatcher

I saw to get good matches I need to set

matcher.knnMatch(,,2); // with k=2 (At least)

If I set k = 1 I don't get the first less distant match for that keypoint.
Are there any reasons?

Upvotes: 1

Views: 861

Answers (1)

Sam
Sam

Reputation: 20056

knnMatch partitions your data in k groups. If k=1, you will put it in one big group.

With a single partition, it will be hard for the algorithm to figure out the distance to a second one. So there will be no distance to calculate at all.

Upvotes: 2

Related Questions