Rust CV mono-repo

Related tags

Image processing cv
Overview

Rust CV

Discord Crates.io docs.rs LoC Tests Lints Build

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

Documentation

Each crate has its own documentation, but the easiest way to check all of the documentation at once is to look at the docs for the cv batteries-included crate.

Check out our tutorial book here! The book source for the tutorials can be found in the tutorial directory of the repository. The example code used in the tutorial can be found in the tutorial-code directory. The resources for tutorials can be found in the site res directory.

About

This repository contains all computer vision crates for Rust CV in a mono-repo, including utilities as well as libraries. When updating libraries, all the crates in this repository should build for a PR to be accepted. Rust CV also maintains some other crates that are related to Computer Vision as well, which are located in the GitHub organization, not in this repository.

Each crate has its own associated license. Rust CV is comprised of different open source licenses, mostly MIT. See the crate directories (or their crates.io entries) for their individual licenses.

Each library was originally its own separate repository before being incorporated into the mono repo. The old repositories that are now in this repo are all archived, but still exist to find tagged versions, assocated commits, and issues. All new PRs should be made to this repository.

What is computer vision

Many people are familiar with covolutional neural networks and machine learning (ML) in computer vision, but computer vision is much more than that. Computer vision broadly encompases image processing, photogrammetry, and pattern recognition. Machine learning can be used in all of these domains (e.g. denoisers, depth map prediction, and face detection), but it is not required. Almost all of the algorithms in this repository are not based on machine learning, but that does not mean you cannot use machine learning with these tools. Please take a look at https://www.arewelearningyet.com/ for Rust ML tools. We may expand into ML more in the future for tasks at which ML outperforms statistical algorithms.

Goals

One of the first things that Rust CV focused on was algorithms in the domain of photogrammetry. Today, Rust now has enough photogrammetry algorithms to perform SfM and visual SLAM. Weakness still exists within image processing and pattern recognition domains.

Here are some of the domains of computer vision that Rust CV intends to persue along with examples of the domain (not all algorithms below live within the Rust CV organization, and some of these may exist and are unknown to us; some things may have changed since this was last updated):

To support computer vision tooling, the following will be implemented:

Credits

TheiaSfM and all of its authors can be thanked as their abstractions are direct inspiration for this crate. In some cases, the names of some abstractions may be borrowed directly if they are consistent. You can find the TheiaSfM documentation here.

"Past, Present, and Future of Simultaneous Localization And Mapping: Towards the Robust-Perception Age" is an excellent paper that compiles information about modern SLAM algorithms and papers.

Comments
  • Update nalgebra and the rest of dependencies to have the crates compile

    Update nalgebra and the rest of dependencies to have the crates compile

    WIP: this is a work in progress

    I've updated nalgebra, nshare, ndarray and started making all the appropriate changes in the cv monorepo. Right now I'm stuck due to a trait bound issue in cv-optimize, coming from argmin which cannot yet be updated to ndarray 0.15 because it itself depends on ndarray-linalg that hasn't been update yet. See https://github.com/argmin-rs/argmin/issues/123

    opened by mpizenberg 16
  • Issue trying the example tutorial

    Issue trying the example tutorial

    I'm trying the example tutorial my code for the main.rs is:

    use image::{DynamicImage, Rgba, GenericImageView};
    use imageproc::drawing;
    use rand::Rng;
    
    fn main() {
        let src_image = image::open("res/0000000000.png").expect("failed to open image file");
    
        let mut rng = rand::thread_rng();
    
        let mut canvas = drawing::Blend(src_image.to_rgba());
        for _ in 0..50 {
            let x : i32 = rng.gen_range(0, src_image.width() - 1) as i32;
            let y : i32 = rng.gen_range(0, src_image.height() - 1) as i32;
            drawing::draw_cross_mut(&mut canvas, Rgba([0, 255, 255, 128]), x as i32, y as i32);
        }
    
        let out_img = DynamicImage::ImageRgba8(canvas.0);
        imgshow::imgshow(&out_img);
    }
    

    my Cargo.toml file:

    [package]
    name = "chapter2-first-program"
    version = "0.1.0"
    authors = ["Walter Perdan <[email protected]>"]
    edition = "2018"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [dependencies]
    imgshow = { git = "https://github.com/rust-cv/cv.git" }
    image = "0.23.7"
    imageproc = "0.21.0"
    rand = "0.7.3"
    
    

    image is in res folder; When i run cargo run:

    Running `target/debug/chapter2-first-program`
    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/walter/.cargo/registry/src/gith
    ub.com-1ecc6299db9ec823/wgpu-native-0.4.3/src/instance.rs:474:72
    stack backtrace:
       0: rust_begin_unwind
                 at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:475
       1: core::panicking::panic_fmt
                 at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/panicking.rs:85
       2: core::panicking::panic
                 at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/panicking.rs:50
       3: core::option::Option<T>::unwrap
                 at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/option.rs:370
       4: wgpu_request_adapter
                 at /home/walter/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.3/src/instance.rs
    :474
       5: wgpu::Adapter::request
                 at /home/walter/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.4.0/src/lib.rs:545
       6: <iced_wgpu::window::backend::Backend as iced_native::window::backend::Backend>::new
                 at /home/walter/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.2.3/src/window/backen
    d.rs:21
     7: iced_winit::application::Application::run
                 at /home/walter/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_winit-0.1.0/src/application.
    rs:180
       8: iced::application::Application::run
                 at /home/walter/.cargo/registry/src/github.com-1ecc6299db9ec823/iced-0.1.1/src/application.rs:201
       9: imgshow::imgshow
                 at /home/walter/.cargo/git/checkouts/cv-f2802c299d0e3a2a/ed1a25e/imgshow/src/lib.rs:12
      10: chapter2_first_program::main
                 at ./src/main.rs:18
      11: core::ops::function::FnOnce::call_once
    
    

    my rustc version:

    rustc --version
    rustc 1.47.0 (18bf6b4f0 2020-10-07)
    
    

    The image is in the target/debug/res folder Infact if i move it i receive the IoError:

    cargo run
       Finished dev [unoptimized + debuginfo] target(s) in 0.17s
        Running `./chapter2-first-program`
    thread 'main' panicked at 'failed to open image file: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })', src/main.rs:6:55
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    

    What is wrong or what i did wrong? Sorry maybe is trivial for you but i'am a newbie with Rust... :slightly_smiling_face:

    opened by kalwalt 8
  • Update Chapter 3 - Akaze feature extraction with correct expected image

    Update Chapter 3 - Akaze feature extraction with correct expected image

    Chapter 3 of the tutorial has the incorrect expected image. The tutorial shows an image with feature matching: akaze-result-1

    but the code that is being run in Chapter 3 of the tutorial only extracts AKAZE feature and draws them on a single image with crosses, which is consistent with the rest of the chapter:

    akaze-result

    The image in the tutorial is located at https://rust-cv.github.io/res/tutorial-images/akaze-result.png, so instead of updating the source, the image at that URL can just be updated to the correct one instead.

    opened by whhuang 3
  • Build fails with Rust 1.54.0

    Build fails with Rust 1.54.0

    Building rust-cv with Rust 1.54.0 fails due to this error:

       [...]
       Compiling cv-sfm v0.1.0 (/Users/fast/Projects/Personal/rust/rust-cv/cv-sfm)
    error[E0658]: use of unstable library feature 'array_map'
        --> cv-sfm/src/lib.rs:1826:27
         |
    1826 |         let poses = views.map(|view| {
         |                           ^^^
         |
         = note: see issue #75243 <https://github.com/rust-lang/rust/issues/75243> for more information
    
    error[E0658]: use of unstable library feature 'array_map'
        --> cv-sfm/src/lib.rs:1844:23
         |
    1844 |                 views.map(|view| {
         |                       ^^^
         |
         = note: see issue #75243 <https://github.com/rust-lang/rust/issues/75243> for more information
    
    error[E0658]: use of unstable library feature 'array_map'
      --> cv-sfm/src/export.rs:95:50
       |
    95 |             [(1, 1), (1, -1), (-1, -1), (-1, 1)].map(|(up, right)| {
       |                                                  ^^^
       |
       = note: see issue #75243 <https://github.com/rust-lang/rust/issues/75243> for more information
    
    error: aborting due to 3 previous errors
    
    For more information about this error, try `rustc --explain E0658`.
    error: could not compile `cv-sfm`
    
    To learn more, run the command again with --verbose.
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    

    What version of Rust shall I use instead?

    opened by sfragis 3
  • Fix the image path in the tutorial code

    Fix the image path in the tutorial code

    The chapter2-first-pogram ../../res/0000000000.png were not working for me on Windows. However this chapter-3-akaze example works great.

    This commit makes both example resolve the images in a similar fashion.

    Also took the liberty to change the implementations to share variable names and spacing.

    opened by Muqito 2
  • vSLAM and frame LSH

    vSLAM and frame LSH

    This changes the internals of cv-reconstruction. Now, frames are matched to each other using an LSH of the bag of features representing the frame using the hamming-lsh crate. This has several benefits, such as being able to better tie together the reconstruction, and guards against problems that occurred with the old model where so many features were added to the ANN search that none of them were sufficiently discriminate, and the number of matches went down as the number of frames added increased. This new technique makes it so that the number of matches (shared observances of a landmark) added is retained during the whole reconstruction.

    One last thing needs to be dealt with, which is merging two reconstructions. This should be possible, but requires more code. Once this is complete, this PR can be merged.

    opened by vadixidav 0
  • imgshow closes entire process after image is shown

    imgshow closes entire process after image is shown

    Due to this iced issue, you cannot show images in the middle of your computer vision processing in Rust. We could either wait until it is possible to close the window, or we could potentially drive iced (see this example) manually, which would give us this ability, but would greatly complicate this simple application.

    opened by vadixidav 0
  • Calibrate camera for distorsion

    Calibrate camera for distorsion

    Hi,

    I'm trying to calibrate a camera against what i believe to be radial distortion. With openCV the method used is calibrateCamera (link). Which usually requires you to use a chessboard pattern in order to identify the actual points and automatically calculate where they should be. I have manually constructed 6 pairs of these points.

    My question is how do we achieve this using rust-cv? It is implemented? I've found something similar in the dlt crate but the output is a 4x3 matrix and i can't really make sense of it. (More details on what i've tried be found here)

    Any help in deeply appreciated.

    Disclaimer: I've been reading for about 2 days and decided to open an issue to you guys , maybe it will also be useful for someone else who's looking for this in the future.

    opened by ironsilk 2
  • removed manual SVD sorting + tested

    removed manual SVD sorting + tested

    This is a PR for https://github.com/rust-cv/cv/issues/51

    There are 4 cases where SVDs were calculated and manually ordered. These now use the already ordered versions from nalgebra. I did not find any cases where an unordered SVD is used.

    Tests were added to ensure everything worked the same as before.

    opened by SpectralFlame 0
  • Does not compile with rust 1.64

    Does not compile with rust 1.64

    I just added cv = "0.6.0" in dependency

    and tried running "cargo check" or "cargo run" is doesn't compile.

    I'm using rust 1.64.

    opened by SujithChristopher 3
  • CV tooling for Point Clouds

    CV tooling for Point Clouds

    See #52. This ticket tracks the creation of PLY tools in Rust CV.

    @Jafagervik Sorry for the late response. I went ahead and made you an owner in Rust CV. You may need to accept the invitation. Once you do, you can make a new repository. Please use the .github folder (and ensure_no_std folder) in the arrsac repository as an example (it is the most up-to-date and correct CI script for things that include no_std support).

    I would recommend making any kind of data structures and traits related to point clouds separate from anything PLY related. I need to do some more work on the space crate once GATs come out, but that is the common integration point for abstractions surrounding NN searches and spatial data structures. Please feel free to file issues on space if you need any additional traits added there (it will likely need many more than it currently has). PLY loading should be separated into its own crate, and you may want to initially limit it to loading PLY data in a streaming fashion (via an iterator or stream if doing async). I recommend starting with a synchronous (not async) version written with nom that just produces an iterator over the parsed PLY data. I can work on this as well, just ping me if you need anything. Discord is preferred.

    We also use PLY in vslam-sandbox (in this repo) and ennona: https://github.com/rust-cv/ennona. Currently we are using poorly maintained crates. It would be nice to make a fresh new crate, but hopefully also something that I can maintain. Feel free to help keep it up to date and maintain it though if you like 😄, but just contributing a PLY parser would be greatly appreciated. I would see how vslam-sandbox exports PLYs and how ennona consumes PLY point cloud data and try to use that as a basis for the requirements of this parser so that way we can replace the ones we use today. You may also want to look at the other PLY parsers that exist today (ply-rs is the best one: https://crates.io/crates/ply-rs).

    Like I said before, lets try to keep everything organized. This should belong in its own repository in Rust CV. This repository is for computer vision primitives that specifically depend on cv-core and implement its traits. Since the PLY crate you are working on is much more broadly applicable than just computer vision, it should belong outside of this mono-repo.

    Let me know if you need anything. Like I said, I am available via the discord server. Find me as vadix on the server.

    opened by vadixidav 0
  • Change SVDs to use new nalgebra APIs

    Change SVDs to use new nalgebra APIs

    nalgebra previously did not sort singular vectors in SVD. However, now it does by default, and it has an option to ask for them unordered as well. See https://docs.rs/nalgebra/0.30.1/nalgebra/base/struct.Matrix.html#method.svd.

    In many places in the code, the SVD is is being explicitly sorted. Ideally, we would like to rely on this new behavior where the SVD is already sorted for us, so this old code can be changed and the sorting can be removed. Also, in any case where we were not sorting the singular values, we can change it to explicitly use the unordered version of the API: https://docs.rs/nalgebra/0.30.1/nalgebra/base/struct.Matrix.html#method.svd_unordered.

    opened by vadixidav 0
  • Integrate ndarray-vision

    Integrate ndarray-vision

    ndarray-vision is where ndarray-based image processing algorithms belong. Currently, the akaze crate does several image processing tasks on its own (fast explicit diffusion, schar filters, etc). We should move these algorithms into ndarray-vision and add it into the mono-repo.

    opened by vadixidav 3
Owner
Rust Computer Vision
Dedicated to making computer vision easier than OpenCV and faster than C++
Rust Computer Vision
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
Visual Odometry in Rust (vors)

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 bi

Matthieu Pizenberg 42 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