opencv_contrib
opencv_contrib copied to clipboard
Integrating Modular SLAM Pipeline into OpenCV Contrib
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
Summary
This PR adds the SLAM module (slam) providing a compact visual odometry and small-scale SLAM toolkit. The module includes feature extraction, matching, two-view initialization, pose estimation, local mapping (MapManager / MapPoint), a simple optimizer (local BA with SFM fallback and optional g2o support), visualizer/top-down trajectory, localizer (PnP-based relocalization), and utilities for loading image sequences and intrinsics.
Motivation
Offer a lightweight, self-contained SLAM implementation that demonstrates how to use OpenCV building blocks for VO/SLAM research and examples. Useful as an educational reference and quick prototyping base for researchers who want to extend or compare with other methods (ORB-SLAM family, etc.). It also provides a straightforward path to enable g2o when available for robust BA.
What changed / what’s included
slam.hpp — module aggregator
vo.hpp — VisualOdometry wrapper
data_loader.hpp — sequence loader with YAML intrinsics parsing
feature.hpp — FeatureExtractor (ORB + ANMS + flow-aware selection)
matcher.hpp — Matcher (ratio test, bucketing, mutual check)
initializer.hpp — Two-view initializer using H/F decomposition + triagulation
pose.hpp — PoseEstimator (essential matrix + recoverPose)
map.hpp & keyframe.hpp — MapManager, MapPoint, KeyFrame
localizer.hpp — PnP-based relocalizer
optimizer.hpp — Optimizer (local BA using either g2o or OpenCV-based SFM fallback)
visualizer.hpp — simple frame/top-down visualization and trajectory saving
Implementation (under src/):
vo.cpp — main VisualOdometry run loop, backend thread for local BA, CSV diagnostics, initialization + tracking + triangulation pipeline
data_loader.cpp — filesystem/glob image enumerator, optional sensor.yaml intrinsics parsing (small comment fix in this PR)
feature.cpp, matcher.cpp, initializer.cpp, pose.cpp, optimizer.cpp, visualizer.cpp, localizer.cpp — corresponding implementations described above