From 4f2597e666bddd3c12d15ac4db532b48b4b449cc Mon Sep 17 00:00:00 2001 From: Phil Ellison Date: Sun, 10 Mar 2024 14:22:26 +0000 Subject: [PATCH 1/3] Fix build --- src/binary_descriptors/brief.rs | 8 ++++---- src/binary_descriptors/mod.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/binary_descriptors/brief.rs b/src/binary_descriptors/brief.rs index 90f20b96..85c3bf61 100644 --- a/src/binary_descriptors/brief.rs +++ b/src/binary_descriptors/brief.rs @@ -338,8 +338,8 @@ mod tests { .into_iter() .map(|_| { Point::new( - rng.gen_range(24, image.width() - 24), - rng.gen_range(24, image.height() - 24), + rng.gen_range(24..image.width() - 24), + rng.gen_range(24..image.height() - 24), ) }) .collect::>>(); @@ -357,8 +357,8 @@ mod tests { .into_iter() .map(|_| { Point::new( - rng.gen_range(24, image.width() - 24), - rng.gen_range(24, image.height() - 24), + rng.gen_range(24..image.width() - 24), + rng.gen_range(24..image.height() - 24), ) }) .collect::>>(); diff --git a/src/binary_descriptors/mod.rs b/src/binary_descriptors/mod.rs index 158fc113..9b8035e7 100644 --- a/src/binary_descriptors/mod.rs +++ b/src/binary_descriptors/mod.rs @@ -79,7 +79,7 @@ pub fn match_binary_descriptors<'a, T: BinaryDescriptor>( for _ in 0..l { // choose k random bits (not necessarily unique) let bits = (0..k) - .map(|_| rng.gen_range(0, queries[0].get_size())) + .map(|_| rng.gen_range(0..queries[0].get_size())) .collect::>(); let mut new_hashmap = HashMap::>::with_capacity(database.len()); @@ -148,8 +148,8 @@ mod tests { .into_iter() .map(|_| { Point::new( - rng.gen_range(20, image.width() - 20), - rng.gen_range(20, image.height() - 20), + rng.gen_range(20..image.width() - 20), + rng.gen_range(20..image.height() - 20), ) }) .collect::>>(); From dc54e9dd4a476eedb67dd6dc742db865b412066c Mon Sep 17 00:00:00 2001 From: Phil Ellison Date: Sun, 10 Mar 2024 14:29:54 +0000 Subject: [PATCH 2/3] Appease clippy --- src/binary_descriptors/brief.rs | 2 -- src/binary_descriptors/mod.rs | 1 - 2 files changed, 3 deletions(-) diff --git a/src/binary_descriptors/brief.rs b/src/binary_descriptors/brief.rs index 85c3bf61..079b8cd3 100644 --- a/src/binary_descriptors/brief.rs +++ b/src/binary_descriptors/brief.rs @@ -335,7 +335,6 @@ mod tests { let image = gray_bench_image(640, 480); let mut rng = rand::thread_rng(); let keypoints = (0..1000) - .into_iter() .map(|_| { Point::new( rng.gen_range(24..image.width() - 24), @@ -354,7 +353,6 @@ mod tests { let image = gray_bench_image(640, 480); let mut rng = rand::thread_rng(); let keypoints = (0..1000) - .into_iter() .map(|_| { Point::new( rng.gen_range(24..image.width() - 24), diff --git a/src/binary_descriptors/mod.rs b/src/binary_descriptors/mod.rs index 9b8035e7..fabb9566 100644 --- a/src/binary_descriptors/mod.rs +++ b/src/binary_descriptors/mod.rs @@ -145,7 +145,6 @@ mod tests { let image = gray_bench_image(640, 480); let mut rng = rand::thread_rng(); let keypoints = (0..1000) - .into_iter() .map(|_| { Point::new( rng.gen_range(20..image.width() - 20), From 09336087ee4e253ebc50af720e9386f4718cffc1 Mon Sep 17 00:00:00 2001 From: Phil Ellison Date: Sun, 10 Mar 2024 14:37:40 +0000 Subject: [PATCH 3/3] Appease cargo doc --- src/binary_descriptors/brief.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/binary_descriptors/brief.rs b/src/binary_descriptors/brief.rs index 079b8cd3..377dc4db 100644 --- a/src/binary_descriptors/brief.rs +++ b/src/binary_descriptors/brief.rs @@ -1,7 +1,7 @@ //! Structs and functions for finding and computing BRIEF descriptors as -//! described in [Calonder, et. al. (2010)][calonder]. +//! described in [Calonder, et. al. (2010)]. /// -/// [calonder]: https://www.cs.ubc.ca/~lowe/525/papers/calonder_eccv10.pdf +/// [Calonder, et. al. (2010)]: https://www.cs.ubc.ca/~lowe/525/papers/calonder_eccv10.pdf use image::{GenericImageView, GrayImage, ImageBuffer, Luma}; use rand_distr::{Distribution, Normal}; @@ -12,9 +12,9 @@ use super::{ BinaryDescriptor, }; -/// BRIEF descriptor as described in [Calonder, et. al. (2010)][calonder]. +/// BRIEF descriptor as described in [Calonder, et. al. (2010)]. /// -/// [calonder]: https://www.cs.ubc.ca/~lowe/525/papers/calonder_eccv10.pdf +/// [Calonder, et. al. (2010)]: https://www.cs.ubc.ca/~lowe/525/papers/calonder_eccv10.pdf #[derive(Clone, PartialEq)] pub struct BriefDescriptor { /// Results of the pairwise pixel intensity tests that comprise this BRIEF @@ -213,7 +213,7 @@ pub(crate) fn brief_impl( /// If `override_test_pairs` is `None`, then `TestPair`s are generated according /// to an isotropic Gaussian. /// -/// Calonder used Gaussian smoothing to decrease the effects of noise in the +/// [Calonder, et. al. (2010)] used Gaussian smoothing to decrease the effects of noise in the /// patches. This is slow, even with a box filter approximation. For maximum /// performance, the average intensities of sub-patches of radius 5 around the /// test points are computed and used instead of the intensities of the test @@ -223,9 +223,7 @@ pub(crate) fn brief_impl( /// descriptors. /// /// [rublee]: http://www.gwylab.com/download/ORB_2012.pdf -/// -/// See [Calonder et. al. -/// (2010)][https://www.cs.ubc.ca/~lowe/525/papers/calonder_eccv10.pdf] +/// [Calonder, et. al. (2010)]: https://www.cs.ubc.ca/~lowe/525/papers/calonder_eccv10.pdf pub fn brief( image: &GrayImage, keypoints: &[Point],