A real-time monocular visual SLAM (Simultaneous Localization and Mapping) system built from scratch in C++20, demonstrating core augmented reality tracking capabilities similar to those used in ARCore and ARKit.
This project implements fundamental AR tracking technology without using existing SLAM libraries, built specifically to demonstrate understanding of computer vision and AR. The system achieves real-time performance (46+ FPS) while tracking 1000+ features simultaneously with 3D visualization.
- Real-time Performance: 1000+ tracked features
- 3D Point Cloud Visualization: OpenGL-based rendering with depth-based coloring
- Robust Feature Tracking: ORB feature detection with KLT optical flow
- Modern C++ Design: C++20 with smart pointers, templates, and RAII principles
- Cross-platform Ready: Designed for Linux with V4L2 camera interface structure
- Real-time operation on standard hardware
- Robust tracking with automatic recovery
- Handles typical handheld camera motion
- Automatic re-detection when tracking degrades
- Memory-efficient design suitable for embedded systems
ar-slam-system/
├── Core Components (src/core/)
│ ├── Frame Management
│ ├── Feature Detection & Tracking
│ └── Memory Management
├── 3D Visualization (src/rendering/)
│ ├── OpenGL 3.3 Core Profile
│ └── Real-time point cloud rendering
└── Testing Framework (tests/)
├── Performance benchmarks
└── Unit tests
sudo apt-get update
sudo apt-get install -y build-essential cmake libopencv-dev libglew-dev libglfw3-dev libglm-dev libeigen3-dev # Clone repository
git clone https://github.com/Maxencejules/ar-slam-system.git
cd ar-slam-system
# Create build directory
mkdir build && cd build
# Configure with CMake (Release mode for best performance)
cmake .. -DCMAKE_BUILD_TYPE=Release
# Build with all cores
make -j$(nproc)
# Run the main 3D tracking demo
./src/camera_3d | Key | Action |
|---|---|
| Arrow Keys | Rotate/zoom 3D view |
| Space | Print performance statistics |
| ESC/Q | Exit application |
- 2D Camera View: Live camera feed with tracked features (green dots), motion trails, and performance stats.
- 3D Point Cloud View: Spatial visualization with depth-based coloring and reference grid floor.
- ORB Feature Detection: Up to 1000 features per frame
- KLT Optical Flow: Pyramidal Lucas-Kanade with 3 levels
- RANSAC: Outlier rejection with fundamental matrix estimation (Epipolar Geometry Constraint)
Custom pool allocator with O(1) allocation/deallocation, maintaining 256MB constraint for embedded systems.
OpenGL 3.3 Core Profile with custom shaders for point cloud rendering.
- Depth Coloring: Near (Red) -> Mid (Green) -> Far (Blue)
- Spatial Context: 3D grid floor for ground plane reference
| Library | Version | Purpose |
|---|---|---|
| OpenCV | 4.6.0 | Computer vision algorithms |
| OpenGL | 3.3+ | 3D rendering |
| GLFW | 3.3+ | Window management |
| GLEW | 2.2+ | OpenGL extensions |
| GLM | 0.9.9+ | Mathematics |
| Eigen3 | 3.4+ | Linear algebra |
ar-slam-system/
├── CMakeLists.txt
├── README.md
├── include/
│ ├── core/
│ │ ├── frame.h
│ │ ├── feature_tracker.h
│ │ └── memory_pool.h
│ └── rendering/
│ └── gl_viewer.h
├── src/
│ ├── camera_3d_test.cpp
│ ├── core/
│ │ ├── frame.cpp
│ │ └── feature_tracker.cpp
│ └── rendering/
│ └── gl_viewer.cpp
└── tests/
├── benchmark/
│ └── benchmark_main.cpp
└── unit/
└── test_features.cpp
- Bundle adjustment for global optimization
- Loop closure detection
- Dense reconstruction
- IMU sensor fusion
- Mobile deployment (Android NDK)
MIT License - see LICENSE file for details.
Maxence Jules
- Email: powe840@gmail.com
- LinkedIn: linkedin.com/in/julesmax
- GitHub: @Maxencejules
Built with passion for augmented reality and computer vision.