Fixing empty descriptors on bad signatures (#1714), (bug from #1698) (#1717)

* Fixing empty descriptors on bad signatures (#1714), (bug from #1698)

* PyDetector: dont assert (just error) if descriptors/keypoints don't match. SuperPoint approaches: try re-initializing superpoint detection on the provided image if descriptors could not be fetched the first time (auto recover).
This commit is contained in:
matlabbe
2026-06-07 13:19:31 -07:00
committed by GitHub
parent f29676deb0
commit 468f6e6f28
4 changed files with 185 additions and 136 deletions
+9 -1
View File
@@ -247,7 +247,15 @@ std::vector<cv::KeyPoint> PyDetector::generateKeypointsImpl(const cv::Mat & imag
cv::Mat PyDetector::generateDescriptorsImpl(const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints) const
{
UASSERT((int)keypoints.size() == descriptors_.rows);
if(!keypoints.empty() && (int)keypoints.size() != descriptors_.rows)
{
UERROR("The number of keypoints (%ld) doesn't match the number of buffered "
"descriptors (%d). PyDetector's descriptors extraction should "
"be called right after keypoints detection, with same keypoints "
"returned by the detection. Returning empty descriptors.",
keypoints.size(), descriptors_.rows);
return cv::Mat();
}
return descriptors_;
}