From ddd48c6ecf5bb8e8c683fea228fe7db70967e058 Mon Sep 17 00:00:00 2001 From: theotherphil Date: Sun, 10 Mar 2024 14:44:06 +0000 Subject: [PATCH] Fix build (#552) * Fix build * Appease clippy * Appease cargo doc --- src/binary_descriptors/brief.rs | 24 ++++++++++-------------- src/binary_descriptors/mod.rs | 7 +++---- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/binary_descriptors/brief.rs b/src/binary_descriptors/brief.rs index 90f20b96..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], @@ -335,11 +333,10 @@ 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), - rng.gen_range(24, image.height() - 24), + rng.gen_range(24..image.width() - 24), + rng.gen_range(24..image.height() - 24), ) }) .collect::>>(); @@ -354,11 +351,10 @@ 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), - 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..fabb9566 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()); @@ -145,11 +145,10 @@ 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), - rng.gen_range(20, image.height() - 20), + rng.gen_range(20..image.width() - 20), + rng.gen_range(20..image.height() - 20), ) }) .collect::>>();