-28 opencv computation_error ai_generated true

cv::error: (-28:有效点数量不足) 在函数 'cv::findHomography' 中

cv::error: (-28:Insufficient number of valid points) in function 'cv::findHomography'

ID: opencv/feature-matching-insufficient-matches

其他格式: JSON · Markdown 中文 · English
82%修复率
88%置信度
1证据数
2024-03-15首次发现

版本兼容性

版本状态引入弃用备注
4.8.0 active — — —
4.9.0 active — — —
4.10.0 active — — —

根因分析

两幅图像之间匹配的特征点数量低于单应性矩阵估计所需的最小值。

English

The number of matched feature points between two images is below the minimum required for homography estimation.

generic

官方文档

https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#ga4abc2ece9fab9398f2e560d53c8c9780

解决方案

  1. Increase the number of keypoints detected by using SIFT with nfeatures=5000 and then apply ratio test (Lowe's ratio < 0.75) to filter matches.
  2. Use FLANN-based matcher with k=2 and then apply cross-check filtering (e.g., cv::BFMatcher with crossCheck=true) to retain only robust matches.

无效尝试

常见但无效的做法:

  1. Lowering the RANSAC reprojection threshold to 1.0 to force more inliers 85% 失败

    Excessively low threshold rejects valid matches, reducing inlier count further.

  2. Using ORB detector with default parameters without tuning 75% 失败

    ORB may generate too few or low-quality matches for scenes with low texture or large viewpoint changes.