From 6a6913c939c24bf2cb995cb22bacb4cb8ec712ed Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sat, 13 Apr 2024 16:42:58 -0700 Subject: [PATCH] Fixed #1262 --- corelib/src/Memory.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/corelib/src/Memory.cpp b/corelib/src/Memory.cpp index b31da3f194..abcd07dbc9 100644 --- a/corelib/src/Memory.cpp +++ b/corelib/src/Memory.cpp @@ -5344,9 +5344,17 @@ Signature * Memory::createSignature(const SensorData & inputData, const Transfor { UASSERT((int)keypoints.size() == descriptors.rows); int inliersCount = 0; - if(_feature2D->getGridRows() > 1 || _feature2D->getGridCols() > 1) - { - Feature2D::limitKeypoints(keypoints, inliers, _feature2D->getMaxFeatures(), decimatedData.imageRaw().size(), _feature2D->getGridRows(), _feature2D->getGridCols()); + if((_feature2D->getGridRows() > 1 || _feature2D->getGridCols() > 1) && + (decimatedData.cameraModels().size()==1 || decimatedData.stereoCameraModels().size()==1 || + data.cameraModels().size()==1 || data.stereoCameraModels().size()==1)) + { + Feature2D::limitKeypoints(keypoints, + inliers, + _feature2D->getMaxFeatures(), + decimatedData.cameraModels().size()?decimatedData.cameraModels()[0].imageSize(): + decimatedData.stereoCameraModels().size()?decimatedData.stereoCameraModels()[0].left().imageSize(): + data.cameraModels().size()?data.cameraModels()[0].imageSize():data.stereoCameraModels()[0].left().imageSize(), + _feature2D->getGridRows(), _feature2D->getGridCols()); for(size_t i=0; igetGridRows() > 1 || _feature2D->getGridCols() > 1) + { + UWARN("Ignored %s and %s parameters as they cannot be used for multi-cameras setup or uncalibrated camera.", + Parameters::kKpGridCols().c_str(), Parameters::kKpGridRows().c_str()); + } Feature2D::limitKeypoints(keypoints, inliers, _feature2D->getMaxFeatures()); inliersCount = _feature2D->getMaxFeatures(); }