Visual Odometry in Rust (vors)

Overview

Visual Odometry in Rust (vors)

This repository provides both a library ("crate" as we say in Rust) named visual-odometry-rs, (shortened vors) and a binary program named vors_track, for camera tracking ("visual odometry").

The program works on datasets following the TUM RGB-D dataset format. It is roughly a hundred lines of code (see src/bin/vors_track.rs), built upon the visual-odometry-rs crate also provided here.

Once you have cloned this repository, you can run the binary program vors_track with cargo directly as follows:

cargo run --release --bin vors_track -- fr1 /path/to/some/freiburg1/dataset/associations.txt

Have a look at mpizenberg/rgbd-tracking-evaluation for more info about the dataset requirements to run the binary program vors_track.

The library is organized around four base namespaces:

  • core:: Core modules for computing gradients, candidate points, camera tracking etc.
  • dataset:: Helper modules for handling specific datasets. Currently only provides a module for TUM RGB-D compatible datasets.
  • math:: Basic math modules for functionalities not already provided by nalgebra, like Lie algebra for so3, se3, and an iterative optimizer trait.
  • misc:: Helper modules for interoperability, visualization, and other things that did not fit elsewhere yet.

Library Usage Examples

Self contained examples for usage of the API are available in the examples/ directory. A readme is also present there for more detailed explanations on these examples.

Functionalities and Vision

Currently, vors provides a visual odometry framework for working on direct RGB-D camera tracking. Setting all this from the ground up took a lot of time and effort, but I think it is mature enough to be shared as is now. Beware, however, that the API is evolving a lot. My hope is that in the near future, we can improve the reach of this project by working both on research extensions, and platform availability.

Example research extensions:

  • Using disparity search for depth initialization to be compatible with RGB (no depth) camera.
  • Adding a photometric term to the residual to account for automatic exposure variations.
  • Adding automatic photometric and/or geometric camera calibration.
  • Building a sliding window of keyframes optimization as in DSO to reduce drift.
  • Intregrating loop closure and pose graph optimization for having a robust vSLAM system.
  • Fusion with IMU for improved tracking and reducing scale drift.
  • Modelization of rolling shutter (in most cameras) into the optimization problem.
  • Extension to stereo cameras.
  • Extension to omnidirectional cameras.

Example platform extensions:

  • Making a C FFI to be able to run on systems with C drivers (kinect, realsense, ...).
  • Porting to the web with WebAssembly.
  • Porting to ARM for running in embedded systems and phones.

Background Story

Initially, this repository served as a personal experimental sandbox for computer vision in Rust. See for example my original questions on the rust discourse and reddit channel. Turns out I struggled a bit at first but then really liked the Rust way, compared to C++.

As the name suggests, the focus is now on visual odometry, specifically on the recent research field of direct visual odometry. A reasonable introduction is available in those lecture slides by Waterloo Autonomous Vehicles lab.

In particular, this project initially aimed at improving on the work of DSO by J. Engel et. al. but with all the advantages of using the Rust programming language, including:

  • Performance without sacrificing code readability
  • No memory error, and much higher code safety and reliability
  • Friendly tooling ecosystem, no dependency issues, basically one-liner compilation and run
  • Best tooling for porting to the web with WebAssembly
  • Growing and mindful resources for porting to embedded systems
  • Wonderful community

License (MPL-2.0)

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contributions

All forms of contribution are welcomed, preferably first as github issues.

  • Questions
  • Documentation
  • Tests
  • Benchmarks
  • Features

In case of contribution to source code, it needs to use rustfmt and clippy. To run clippy:

touch src/lib.rs; cargo clippy --release --all-targets --all-features
Comments
  • RGB only?

    RGB only?

    Hello,

    This looks like a great project! I'm not very familiar with VO / CV in general. It seems that a depth map is necessary for each frame.

    Is it possible to use this library without depth maps? If not, can you suggest a way to calculate/approximate them?

    My goal is simply to determine the motion of a camera through a static environment given a set of RGB images.

    Thanks! Oliver

    opened by OliverEvans96 3
  • Excellent way of using conrod

    Excellent way of using conrod

    Thanks for this excellent work which makes using conrod much easier ...

    There seems to be a problem when closing the prog window. Here is the error message I receive when closing the program : thread 'main' panicked at 'Failed to close input method: XError { description: "BadDrawable (invalid Pixmap or Window parameter)", error_code: 9, request_code: 14, minor_code: 0 }', libcore/result.rs:945:5

    Working on ubuntu 18.04 gnome - x11

    opened by LeonGGX 1
  • Robust estimators

    Robust estimators

    Black 1996 uses Geman-McClure robust M-estimator.

    @article{black1996robust,
      title={The robust estimation of multiple motions: Parametric and piecewise-smooth flow fields},
      author={Black, Michael J and Anandan, Paul},
      journal={Computer vision and image understanding},
      volume={63},
      number={1},
      pages={75--104},
      year={1996},
      publisher={Elsevier}
    }
    

    Zhang 1997 presents parameters estimation from noisy data, including robust techniques such as M-estimators and least median of squares (but not Ransac!).

    @article{zhang1997parameter,
      title={Parameter estimation techniques: A tutorial with application to conic fitting},
      author={Zhang, Zhengyou},
      journal={Image and vision Computing},
      volume={15},
      number={1},
      pages={59--76},
      year={1997},
      publisher={Elsevier}
    }
    

    Stewart 1999 presents usage of M-estimators and least median squares (LMS) and RANSAC in the context of computer vision.

    @article{stewart1999robust,
      title={Robust parameter estimation in computer vision},
      author={Stewart, Charles V},
      journal={SIAM review},
      volume={41},
      number={3},
      pages={513--537},
      year={1999},
      publisher={SIAM}
    }
    

    In part 2 of Baker 2003, the authors show how a robust M-estimator can be used within an inverse compositional iteratively reweighted least squares (IRLS) algorithm

    @inproceedings{baker2003lucas,
      title={Lucas-kanade 20 years on: A unifying framework: Part 2},
      author={Baker, Simon and Gross, Ralph and Ishikawa, Takahiro and Matthews, Iain},
      booktitle={International Journal of Computer Vision},
      year={2003},
      organization={Citeseer}
    }
    

    In Audras 2011, the authors use a robust M-estimator

    @inproceedings{audras2011real,
      title={Real-time dense appearance-based SLAM for RGB-D sensors},
      author={Audras, Cedric and Comport, A and Meilland, Maxime and Rives, Patrick},
      booktitle={Australasian Conf. on Robotics and Automation},
      volume={2},
      pages={2--2},
      year={2011}
    }
    

    Klose 2013 uses robust M-estimator Huber and Tukey. Removes median abs res, and estimate std before computing weights. Also introduce global affine illumination changes.

    @inproceedings{klose2013efficient,
      title={Efficient compositional approaches for real-time robust direct visual odometry from RGB-D data},
      author={Klose, Sebastian and Heise, Philipp and Knoll, Alois},
      booktitle={2013 IEEE/RSJ International Conference on Intelligent Robots and Systems},
      pages={1100--1106},
      year={2013},
      organization={IEEE}
    }
    

    In Kerl 2013, they use a t-distribution instead of M-estimator.

    @inproceedings{kerl2013robust,
      title={Robust odometry estimation for RGB-D cameras},
      author={Kerl, Christian and Sturm, J{\"u}rgen and Cremers, Daniel},
      booktitle={2013 IEEE international conference on robotics and automation},
      pages={3748--3754},
      year={2013},
      organization={IEEE}
    }
    

    Gutierrez 2015 evaluate huber, tukey and Student t-distribution. Find that t-dist is best and more stable.

    @inproceedings{gutierrez2015inverse,
      title={Inverse depth for accurate photometric and geometric error minimisation in RGB-D dense visual odometry},
      author={Guti{\'e}rrez-G{\'o}mez, Daniel and Mayol-Cuevas, Walterio and Guerrero, Josechu J},
      booktitle={2015 IEEE International Conference on Robotics and Automation (ICRA)},
      pages={83--89},
      year={2015},
      organization={IEEE}
    }
    
    opened by mpizenberg 0
  • Reduce the number of dependencies

    Reduce the number of dependencies

    • [ ] Input-Output (IO) should be independent from this library. This concerns the image, png, byteorder and nom crates.
    • [ ] itertools is used only once for the izip function, to zip 3 vectors in the same loop. It probably isn't worth the dependency.
    • [ ] num-traits is only used in dso candidates selection implementation for the Number trait. Maybe there is a way of doing it without the dependency. Maybe it shouldn't even be generic since for now, this implementation is only done for u16 gradient images.
    • [ ] Random number generation is only used in candidates::dso. DSO is also the cause of num-traits, and one implementation should not bring too many dependencies. It might be a good idea to make candidates selection a trait somehow, and separate coarse to fine and dso's implementations into another code base?
    opened by mpizenberg 0
  • Remove (and fix) clippy locally disabled features

    Remove (and fix) clippy locally disabled features

    They are easily found by searching for "clippy". Mostly, the disabled features are:

    • [ ] excessive_precision: typically, f32 floats with too many figures. Those should be removed when the corresponding code becomes generic over f32 and f64.
    • [ ] many_single_char_names: happens in most "bloc" functions where a 1-letter name is given for each sub pixel to make equations readable. It should probably be smarter to use at least 2 letters though. Something like tl, bl, tr, br for top left, bottom left, etc.
    • [ ] cast warnings.
    opened by mpizenberg 0
Owner
Matthieu Pizenberg
Raclette lover -- Retired Pokemon master -- Robots maker -- Tennis player -- Functional programming newbie -- Post-doc in computer vision
Matthieu Pizenberg
Encoding and decoding images in Rust

Image Maintainers: @HeroicKatora, @fintelia How to contribute An Image Processing Library This crate provides basic image processing functions and met

image-rs 3.5k Jan 9, 2023
Rust bindings for OpenCV 3 & 4

Rust OpenCV bindings Experimental Rust bindings for OpenCV 3 and 4. The API is usable, but unstable and not very battle-tested; use at your own risk.

null 1.2k Dec 30, 2022
A simple steganography library written in rust

steganography A stable steganography library written in rust Crates.io Usage Add the following to the Cargo.toml in your project: [dependencies] stega

Teodor Voinea 79 Dec 9, 2022
Zero dependency images (of chaos) in Rust

bifurcate-rs Zero dependency images (of chaos) in Rust To run: time cargo run --release > img.pgm To convert from PGM to PNG using Image Magick: conve

Stephen Merity 32 Nov 17, 2021
tai (Terminal Ascii Image) tool to convert images to ascii written in Rust

TAI Terminal Ascii Image A tool to convert images to ascii art written in Rust ?? Notes This tool is still in development stage. Contributions All Con

Mustafa Salih 258 Dec 5, 2022
🎨 Example-based texture synthesis written in Rust 🦀

?? texture-synthesis A light Rust API for Multiresolution Stochastic Texture Synthesis [1], a non-parametric example-based algorithm for image generat

Embark 1.7k Dec 31, 2022
Face detection library for the Rust programming language

Rustface SeetaFace detection library for the Rust programming language Example of demo program output SEETAFACE C++ – Github repository for the origin

Andrei Tomashpolskiy 323 Dec 27, 2022
Rust CV mono-repo

Rust CV Rust CV is a project to implement computer vision algorithms, abstractions, and systems in Rust. #[no_std] is supported where possible. Docume

Rust Computer Vision 429 Dec 29, 2022
A Telegram Bot written in Rust to Track new Github releases

Release Tracker This is used to track Releases posted on GitHub Releases and Post it on a Telegram Channel/Group. Setup Export env variables or just f

Kartikeya Hegde 20 Jul 7, 2022
A Simple-to-use, cross-platform Rust Webcam Capture Library

Cross Platform Rust Library for powerful Webcam Capture and Virtual Webcams

null 246 Jan 8, 2023
Classical Rainbow Triangle using Rust and Vulkan via vulkano bindings

Vulkano Rainbow Triangle Classical Rainbow Triangle using Rust and Vulkan via vulkano bindings. Based on the vulkano triangle example Quick Start $ ca

Tsoding 14 Dec 30, 2022
A simple image average color extractor written in 🦀 Rust

A simple image average color extractor written in ?? Rust

Victor Aremu 3 Sep 23, 2021
A simple command-line utility (and Rust crate!) for converting from a conventional image file (e.g. a PNG file) into a pixel-art version constructed with emoji

EmojiPix This is a simple command-line utility (and Rust crate!) for converting from a conventional image file (e.g. a PNG file) into a pixel-art vers

Michael Milton 22 Dec 6, 2022
Silicon is an alternative to Carbon implemented in Rust.

Silicon is an alternative to Carbon implemented in Rust.

Aloxaf 2.3k Dec 27, 2022
😱 Dead fast thumbnail library for browser and NodeJs! Built with Rust 🦀 and WebAssembly 🕸

thumbo-core ?? Dead fast thumbnail library for browser and NodeJs Built with Rust ?? & WebAssembly ?? ?? About thumbo-core is a thubnail library for b

Victor Aremu 12 Dec 2, 2022
A Simple Image to Ascii converter in Rust

Image to Ascii A Simple Image to Ascii converter in Rust Brief ?? In my way to learn Rust i decided to make this converter. Challenges ?? new to Rust

WasixXD 7 Sep 16, 2022
@Buildspace project creating a Web3 Solana Dapp with React and Rust

buildspace Solana GIF Portal Project Welcome ?? To get started with this course, clone this repo and follow these commands: Run npm install at the roo

Nick Fragakis 2 Jul 22, 2022
Boids example ported from wgpu to rust-gpu

wgpu is Rust's main GPU project and rust-gpu is a project to write GPU shaders in Rust.

Thomas Buckley-Houston 2 Dec 1, 2022
OpenCV Sample Projects in Rust

OpenCV Sample Projects in Rust

iwatake 9 Jan 28, 2022