1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #29331 from agrim-rai/slamVO

[GSOC] Added Visual Odometry (VO) for SLAM
This commit is contained in:
Abhishek Gola
2026-07-25 10:34:00 +05:30
committed by GitHub
29 changed files with 2746 additions and 2 deletions
@@ -998,6 +998,19 @@ public:
*/
CV_WRAP virtual bool isMaskSupported() const = 0;
/** @brief Provides keypoint and image-size context for matchers that need it (e.g. LightGlueMatcher).
Must be called before match()/knnMatch()/radiusMatch() for matchers that require this context.
Matchers that don't need it (e.g. BFMatcher, FlannBasedMatcher) ignore the call.
@param queryKpts Query image keypoints.
@param trainKpts Train image keypoints.
@param queryImageSize Size of the query image (width, height).
@param trainImageSize Size of the train image (width, height).
*/
CV_WRAP virtual void setImagePairInfo(const std::vector<KeyPoint>& queryKpts, const std::vector<KeyPoint>& trainKpts,
Size queryImageSize = Size(), Size trainImageSize = Size());
/** @brief Trains a descriptor matcher
Trains a descriptor matcher (for example, the flann index). In all methods to match, the method
@@ -1349,6 +1362,10 @@ public:
/** @brief Clears stored pair context information.
*/
CV_WRAP virtual void clearPairInfo() = 0;
/** @brief Convenience overload of setPairInfo() taking keypoints directly. */
CV_WRAP void setImagePairInfo(const std::vector<KeyPoint>& queryKpts, const std::vector<KeyPoint>& trainKpts,
Size queryImageSize = Size(), Size trainImageSize = Size()) CV_OVERRIDE;
};
//! @} features_match
+4
View File
@@ -580,6 +580,10 @@ bool DescriptorMatcher::empty() const
void DescriptorMatcher::train()
{}
void DescriptorMatcher::setImagePairInfo( const std::vector<KeyPoint>&, const std::vector<KeyPoint>&,
Size, Size )
{}
void DescriptorMatcher::match( InputArray queryDescriptors, InputArray trainDescriptors,
std::vector<DMatch>& matches, InputArray mask ) const
{
@@ -15,6 +15,26 @@ namespace cv
LightGlueMatcher::LightGlueMatcher() {}
LightGlueMatcher::~LightGlueMatcher() {}
void LightGlueMatcher::setImagePairInfo(const std::vector<KeyPoint>& queryKpts, const std::vector<KeyPoint>& trainKpts,
Size queryImageSize, Size trainImageSize)
{
Mat qk((int)queryKpts.size(), 2, CV_32F);
for (size_t i = 0; i < queryKpts.size(); ++i)
{
qk.at<float>((int)i, 0) = queryKpts[i].pt.x;
qk.at<float>((int)i, 1) = queryKpts[i].pt.y;
}
Mat tk((int)trainKpts.size(), 2, CV_32F);
for (size_t i = 0; i < trainKpts.size(); ++i)
{
tk.at<float>((int)i, 0) = trainKpts[i].pt.x;
tk.at<float>((int)i, 1) = trainKpts[i].pt.y;
}
setPairInfo(qk, tk, queryImageSize, trainImageSize);
}
#ifdef HAVE_OPENCV_DNN
struct LightGluePairContext