1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Fix: BFMatcher isMaskSupported false on crossCheck

isMaskSupported now returns false when the matcher is
created with crossCheck enabled, because the mask
path is unsupported in that mode. knnMatchImpl also
drops the mask so it cannot reach batchDistance and
trigger its mask.empty() assertion.

https://github.com/opencv/opencv/issues/22093
This commit is contained in:
Anand Mahesh
2026-07-13 07:58:58 +05:30
parent 8fdf15e26e
commit 0fb620f0f0
3 changed files with 78 additions and 2 deletions
+2 -1
View File
@@ -996,8 +996,9 @@ void BFMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector<std::vec
for( iIdx = 0; iIdx < imgCount; iIdx++ )
{
CV_Assert( trainDescCollection[iIdx].rows < IMGIDX_ONE );
Mat mask = (crossCheck || masks.empty()) ? Mat() : masks[iIdx];
batchDistance(queryDescriptors, trainDescCollection[iIdx], dist, dtype, nidx,
normType, knn, masks.empty() ? Mat() : masks[iIdx], update, crossCheck);
normType, knn, mask, update, crossCheck);
update += IMGIDX_ONE;
}