mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-10 11:59:50 +08:00
PyDetector: adding check if returned descriptors are empty (#1715)
* PyDetector: adding check if returned descriptors are empty (addressing #1714) * Throwing error instead of asserting if keypoints and descriptors mistmatch * ading error instead of warning * lets do warnings instead (could be possible that images are blanck)
This commit is contained in:
@@ -144,7 +144,12 @@ std::vector<cv::KeyPoint> SPDetector::detect(const cv::Mat &img, const cv::Mat &
|
||||
UASSERT(img.type() == CV_8UC1);
|
||||
UASSERT(mask.empty() || (mask.type() == CV_8UC1 && img.cols == mask.cols && img.rows == mask.rows));
|
||||
detected_ = false;
|
||||
if(model_)
|
||||
if(!model_)
|
||||
{
|
||||
UERROR("No model is loaded!");
|
||||
return std::vector<cv::KeyPoint>();
|
||||
}
|
||||
try
|
||||
{
|
||||
torch::NoGradGuard no_grad_guard;
|
||||
auto x = torch::from_blob(img.data, {1, 1, img.rows, img.cols}, torch::kByte);
|
||||
@@ -199,9 +204,9 @@ std::vector<cv::KeyPoint> SPDetector::detect(const cv::Mat &img, const cv::Mat &
|
||||
detected_ = true;
|
||||
return keypoints;
|
||||
}
|
||||
else
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
UERROR("No model is loaded!");
|
||||
UERROR("SPDetector::detect() threw: %s", e.what());
|
||||
return std::vector<cv::KeyPoint>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user