Skip to content

Commit

Permalink
Merge pull request #33 from rust-cv/compilable
Browse files Browse the repository at this point in the history
Update nalgebra and the rest of dependencies to have the crates compile
  • Loading branch information
vadixidav committed Jul 12, 2021
2 parents 5fba7b0 + a66a528 commit 65234dc
Show file tree
Hide file tree
Showing 40 changed files with 294 additions and 339 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/build-all.yml

This file was deleted.

45 changes: 30 additions & 15 deletions .github/workflows/lints.yml
@@ -1,12 +1,14 @@
# Cargo fmt and cargo clippy

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

name: lints

jobs:
combo:
name: Clippy + rustfmt
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -18,25 +20,38 @@ jobs:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy

- name: Cache lints
uses: actions/cache@v2
components: rustfmt

- uses: Swatinem/rust-cache@v1
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: lints-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
cache-on-failure: true

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: clippy

- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings
args: -- -D warnings
27 changes: 14 additions & 13 deletions .github/workflows/unit-test.yml → .github/workflows/tests.yml
@@ -1,14 +1,20 @@
# Cargo test
on:
push:
branches:
- master
pull_request:

on: [push, pull_request]

name: unit tests
name: tests

jobs:
test:
name: Test
tests:
name: tests
runs-on: ubuntu-latest
steps:
- name: Install system dependencies
run: |
sudo apt-get -y install libxkbcommon-dev
- name: Checkout sources
uses: actions/checkout@v2

Expand All @@ -19,14 +25,9 @@ jobs:
toolchain: nightly
override: true

- name: Cache test
uses: actions/cache@v2
- uses: Swatinem/rust-cache@v1
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: test-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
cache-on-failure: true

- name: Run cargo test
uses: actions-rs/cargo@v1
Expand Down
19 changes: 10 additions & 9 deletions README.md
@@ -1,6 +1,6 @@
# Rust CV

[![Discord][dci]][dcl] [![Crates.io][ci]][cl] [![docs.rs][di]][dl] ![LoC][lo] ![Tests][btl] ![Lints][bll] ![Build][bbl]
[![Discord][dci]][dcl] [![Crates.io][ci]][cl] [![docs.rs][di]][dl] ![LoC][lo] ![Tests][btl] ![Lints][bll]

[ci]: https://img.shields.io/crates/v/cv.svg
[cl]: https://crates.io/crates/cv/
Expand All @@ -13,9 +13,8 @@
[dci]: https://img.shields.io/discord/550706294311485440.svg?logo=discord&colorB=7289DA
[dcl]: https://discord.gg/d32jaam

[btl]: https://github.com/rust-cv/cv/workflows/unit%20tests/badge.svg
[btl]: https://github.com/rust-cv/cv/workflows/tests/badge.svg
[bll]: https://github.com/rust-cv/cv/workflows/lints/badge.svg
[bbl]: https://github.com/rust-cv/cv/workflows/build/badge.svg

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

Expand Down Expand Up @@ -74,10 +73,11 @@ Here are some of the domains of computer vision that Rust CV intends to persue a
* [ ] Equirectangular ([Wikipedia](https://en.wikipedia.org/wiki/Equirectangular_projection))
* [ ] Matching ([Wikipedia](https://en.wikipedia.org/wiki/Point_feature_matching))
* [x] Descriptor matching strategies
* [x] [Brute force](https://docs.rs/space/0.10.3/space/fn.linear_knn.html) (for camera traking with binary features)
* [x] [HNSW](https://docs.rs/hnsw/0.6.1/hnsw/struct.HNSW.html) (for loop closure)
* [x] [Brute force](https://docs.rs/space/0.13.1/space/struct.LinearKnn.html) (for camera traking with binary features)
* [x] [HGG](https://docs.rs/hgg/0.2.0/hgg/) (for loop closure)
* [x] [HNSW](https://docs.rs/hnsw/0.9.1/hnsw/struct.Hnsw.html) (for loop closure)
* [ ] Filtering strategies
* [ ] Symmetric matching (exists [within cv-reconstruction](https://github.com/rust-cv/cv/blob/58444de1cb174622ac34cc705ab9142e081f412c/cv-reconstruction/src/lib.rs#L1337))
* [ ] Symmetric matching/uniquely best match (exists [within cv-reconstruction](https://github.com/rust-cv/cv/blob/58444de1cb174622ac34cc705ab9142e081f412c/cv-reconstruction/src/lib.rs#L1337), but not reusable)
* [ ] Lowe's ratio test matching
* [ ] Geometric verification (utilized abstractions in [sample-consensus](https://docs.rs/sample-consensus/0.2.0/sample_consensus/))
* [ ] [Consensus algorithms](https://docs.rs/sample-consensus/0.2.0/sample_consensus/trait.Consensus.html)
Expand Down Expand Up @@ -129,9 +129,10 @@ Here are some of the domains of computer vision that Rust CV intends to persue a
* [ ] Surface refinement
* [ ] Texturing ([related Wikipedia](https://en.wikipedia.org/wiki/Texture_mapping))
* [ ] Pattern recognition
* [x] k-NN search
* [x] [Brute force](https://docs.rs/space/0.10.3/space/fn.linear_knn.html)
* [x] [HNSW](https://docs.rs/hnsw/0.6.1/hnsw/struct.HNSW.html)
* [x] [k-NN search](https://docs.rs/space/0.13.1/space/trait.Knn.html)
* [x] [Brute force](https://docs.rs/space/0.13.1/space/struct.LinearKnn.html)
* [x] [HGG](https://docs.rs/hgg/0.2.0/hgg/) (for loop closure)
* [x] [HNSW](https://docs.rs/hnsw/0.9.1/hnsw/struct.Hnsw.html)
* [x] [FLANN](https://docs.rs/flann/0.1.0/flann/)
* [ ] Face recognition ([Wikipedia](https://en.wikipedia.org/wiki/Facial_recognition_system))
* [ ] Articulated body pose estimation ([Wikipedia](https://en.wikipedia.org/wiki/Articulated_body_pose_estimation))
Expand Down
21 changes: 10 additions & 11 deletions akaze/Cargo.toml
Expand Up @@ -16,25 +16,24 @@ cv-core = { version = "0.15.0", path = "../cv-core" }
image = { version = "0.23.14", default-features = false }
log = { version = "0.4.14", default-features = false }
primal = { version = "0.3.0", default-features = false }
derive_more = { version = "0.99.11", default-features = false }
nshare = { version = "0.2.0", features = ["ndarray", "image"] }
ndarray = { version = "0.14.0", default-features = false }
float-ord = { version = "0.2.0", default-features = false }
space = "0.10.3"
bitarray = "0.2.6"
derive_more = { version = "0.99.16", default-features = false }
nshare = { version = "0.7.0", features = ["ndarray", "image"] }
ndarray = { version = "0.15.3", default-features = false }
float-ord = { version = "0.3.1", default-features = false }
space = "0.14.0"
bitarray = "0.5.1"


[dev-dependencies]
eight-point = { version = "0.8.0", path = "../eight-point" }
cv-pinhole = { version = "0.6.0", path = "../cv-pinhole" }
arrsac = "0.6.1"
space = "0.10.3"
rand = "0.8.3"
rand_pcg = "0.3.0"
arrsac = "0.7.0"
rand = "0.8.4"
rand_pcg = "0.3.1"
criterion = "0.3.4"
pretty_env_logger = "0.4.0"
image = "0.23.14"
bitarray = { version = "0.2.6", features = ["space"] }
bitarray = { version = "0.5.1", features = ["space"] }

[[bench]]
name = "criterion"
Expand Down
4 changes: 2 additions & 2 deletions akaze/src/derivatives.rs
Expand Up @@ -13,7 +13,7 @@ use ndarray::{s, Array2, ArrayView2, ArrayViewMut2};
/// Output image derivative (an image.)
pub fn scharr_horizontal(image: &GrayFloatImage, sigma_size: u32) -> GrayFloatImage {
let img_horizontal = scharr_axis(
&image,
image,
sigma_size,
FilterDirection::Horizontal,
FilterOrder::Main,
Expand All @@ -38,7 +38,7 @@ pub fn scharr_horizontal(image: &GrayFloatImage, sigma_size: u32) -> GrayFloatIm
/// Output image derivative (an image.)
pub fn scharr_vertical(image: &GrayFloatImage, sigma_size: u32) -> GrayFloatImage {
let img_horizontal = scharr_axis(
&image,
image,
sigma_size,
FilterDirection::Horizontal,
FilterOrder::Off,
Expand Down
2 changes: 1 addition & 1 deletion akaze/src/descriptors.rs
Expand Up @@ -59,7 +59,7 @@ impl Akaze {
co,
si,
scale,
&evolutions,
evolutions,
);
mldb_binary_comparisons(
&values,
Expand Down
2 changes: 1 addition & 1 deletion akaze/src/image.rs
Expand Up @@ -257,7 +257,7 @@ pub fn gaussian_blur(image: &GrayFloatImage, r: f32) -> GrayFloatImage {
// a separable Gaussian kernel
let kernel_size = (f32::ceil(r) as usize) * 2 + 1usize;
let kernel = gaussian_kernel(r, kernel_size);
let img_horizontal = horizontal_filter(&image, &kernel);
let img_horizontal = horizontal_filter(image, &kernel);
vertical_filter(&img_horizontal, &kernel)
}

Expand Down
2 changes: 1 addition & 1 deletion akaze/src/lib.rs
Expand Up @@ -230,7 +230,7 @@ impl Akaze {
/// ```
///
pub fn extract(&self, image: &DynamicImage) -> (Vec<KeyPoint>, Vec<BitArray<64>>) {
let float_image = GrayFloatImage::from_dynamic(&image);
let float_image = GrayFloatImage::from_dynamic(image);
let mut evolutions = self.allocate_evolutions(image.width(), image.height());
self.create_nonlinear_scale_space(&mut evolutions, &float_image);
trace!("Finding image keypoints.");
Expand Down
4 changes: 2 additions & 2 deletions akaze/src/scale_space_extrema.rs
Expand Up @@ -141,7 +141,7 @@ impl Akaze {
/// The resulting keypoints.
pub fn detect_keypoints(&self, evolutions: &mut Vec<EvolutionStep>) -> Vec<KeyPoint> {
let mut keypoints = self.find_scale_space_extrema(evolutions);
keypoints = do_subpixel_refinement(&keypoints, &evolutions);
keypoints = do_subpixel_refinement(&keypoints, evolutions);
keypoints
}
}
Expand Down Expand Up @@ -332,7 +332,7 @@ fn do_subpixel_refinement(
in_keypoints.len()
);
for mut keypoint in result.iter_mut() {
compute_main_orientation(&mut keypoint, &evolutions);
compute_main_orientation(&mut keypoint, evolutions);
}
result
}
10 changes: 3 additions & 7 deletions akaze/tests/estimate_pose.rs
Expand Up @@ -7,6 +7,7 @@ use cv_core::{CameraModel, FeatureMatch};
use log::*;
use rand::SeedableRng;
use rand_pcg::Pcg64;
use space::Knn;
use std::path::Path;

const LOWES_RATIO: f32 = 0.5;
Expand Down Expand Up @@ -73,16 +74,11 @@ fn estimate_pose() {
}

fn match_descriptors(ds1: &[Descriptor], ds2: &[Descriptor]) -> Vec<(usize, usize)> {
use space::Neighbor;
let two_neighbors = ds1
.iter()
.map(|d1| {
let mut neighbors = [Neighbor::invalid(); 2];
assert_eq!(
space::linear_knn(d1, &mut neighbors, ds2).len(),
2,
"there should be at least two matches"
);
let neighbors = space::LinearKnn(ds2.iter()).knn(d1, 2);
assert_eq!(neighbors.len(), 2, "there should be at least two matches");
neighbors
})
.enumerate();
Expand Down
7 changes: 4 additions & 3 deletions cv-core/Cargo.toml
Expand Up @@ -15,11 +15,12 @@ readme = "README.md"
serde-serialize = ["serde", "nalgebra/serde-serialize"]

[dependencies]
nalgebra = { version = "0.25.3", default-features = false, features = ["libm"] }
derive_more = "0.99.11"
# TODO: Fix this once alloc feature is working again.
nalgebra = { version = "0.28.0", default-features = false, features = ["std"] }
derive_more = "0.99.16"
sample-consensus = "1.0.1"
num-traits = { version = "0.2.14", default-features = false }
serde = { version = "1.0.124", default-features = false, features = ["derive"], optional = true }
serde = { version = "1.0.126", default-features = false, features = ["derive"], optional = true }

[package.metadata.docs.rs]
all-features = true
1 change: 1 addition & 0 deletions cv-core/src/camera.rs
Expand Up @@ -51,6 +51,7 @@ impl Bearing for Unit<Vector3<f64>> {
Unit::new_normalize(bearing)
}

#[allow(clippy::wrong_self_convention)]
fn from_bearing_unit_vector(bearing: Unit<Vector3<f64>>) -> Self {
bearing
}
Expand Down
2 changes: 1 addition & 1 deletion cv-geom/Cargo.toml
Expand Up @@ -13,4 +13,4 @@ readme = "README.md"

[dependencies]
cv-core = { version = "0.15.0", path = "../cv-core" }
float-ord = "0.2.0"
float-ord = "0.3.1"
11 changes: 5 additions & 6 deletions cv-optimize/Cargo.toml
Expand Up @@ -5,11 +5,10 @@ authors = ["Geordon Worley <vadixidav@gmail.com>"]
edition = "2018"

[dependencies]
levenberg-marquardt = "0.8.0"
levenberg-marquardt = "0.10.0"
cv-core = { version = "0.15.0", path = "../cv-core" }
nalgebra = { version = "0.25.3", features = ["alloc"], default-features = false }
nalgebra = { version = "0.28.0", features = ["alloc"], default-features = false }
num-traits = "0.2.14"
argmin = { version = "0.4.1", features = ["ndarrayl"] }
ndarray = "0.14.0"
average = "0.10.6"
itertools = "0.10.0"
argmin = "0.4.5"
average = "0.13.1"
itertools = "0.10.1"

0 comments on commit 65234dc

Please sign in to comment.