This module provides a prototype solution for RGB-D SLAM (Simultaneous Localization and Mapping) using Python. The code integrates several key libraries, such as OpenCV, Open3D, and SciPy, to process RGB-D images, perform visual odometry, and visualize results.
- Loading Camera Intrinsics: Load camera intrinsics from a file.
- Combining RGB and Depth Images: Combine RGB and depth images for processing.
- Visualizing RGB-D Images: Visualize RGB-D images using Matplotlib and Open3D.
- Performing RGB-D Odometry: Perform visual odometry using Open3D.
- Sequence Processing: Process sequences of RGB-D images.
- Hybrid Visual Odometry: Combine color and depth information for odometry using feature tracking and 3D points.
pip install rgbdslam-
Clone this repository:
git clone https://github.com/hugohadfield/rgbdslam.git cd rgbdslam -
Install with pip:
pip install .
Ensure you have the following Python libraries installed:
- numpy
- Pillow
- click
- matplotlib
- tqdm
- pandas
- open3d
- opencv-python
- scipy
You can install these dependencies using pip:
pip install numpy Pillow click matplotlib tqdm pandas open3d opencv-python scipyThe module provides a command-line interface (CLI) to process images.
Process a single pair of RGB and depth images:
python slam.py single-image-pair <rgb_path_a> <depth_path_a> <rgb_path_b> <depth_path_b>Process a directory of RGB and depth images:
python slam.py run-on-directory <rgb_path> <depth_path> <output_csv>To run the SLAM algorithm on a directory of images:
python slam.py run-on-directory rgb/ depth/ output.csvThis command processes all RGB and depth images in the rgb/ and depth/ directories and saves the results in output.csv.
Load camera intrinsics from a file.
Combine RGB and depth images into a single image for processing.
Visualize an RGBD image using Matplotlib.
Visualize an RGBD image using Open3D.
Extract translation information from a 4x4 transformation matrix.
Perform RGBD Odometry using Open3D.
o3d_rgbd_sequence(rgbd_image_list: List[np.ndarray], intrinsic_matrix: np.ndarray, use_tqdm: bool = True)
Process a sequence of RGB-D images.
Extract yaw and distance using SciPy's minimize function.
Extract yaw and distance using OpenCV's solvePnPRansac.
hybrid_rgbd_odometry(rgbd_image_list: List[np.ndarray], intrinsic_matrix: np.ndarray, use_tqdm: bool = True, backward: bool = False)
Perform hybrid visual odometry using both color and depth information.
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.
For questions or suggestions, please get in contact with Hugo Hadfield, contact details can be found on his website.
