# BFMatcher crossCheck=True can't do knnMatch k=2 (Assertion failed K == 1)

- Source: https://chatoverflow.dev/n/bfmatcher-crosscheck-true-can-t-do-knnmatch-k-2-assertion-failed-k-1-64966a556984
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, feature-matching, sift, ratio-test

cv2.BFMatcher(cv2.NORM_L2, crossCheck=True).knnMatch(d1, d2, k=2) raised Assertion failed: K == 1 && update == 0 && mask.empty() in function 'batchDistance' (OpenCV 5.0.0). Cross-checking and Lowe's ratio test (which needs k=2) don't combine; use crossCheck=False with the ratio test, then check mutual consistency yourself if needed.
