Skip to content

Commit

Permalink
Fix build (#552)
Browse files Browse the repository at this point in the history
* Fix build

* Appease clippy

* Appease cargo doc
  • Loading branch information
theotherphil authored Mar 10, 2024
1 parent 08738c5 commit ddd48c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
24 changes: 10 additions & 14 deletions src/binary_descriptors/brief.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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<u32>],
Expand Down Expand Up @@ -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::<Vec<Point<u32>>>();
Expand All @@ -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::<Vec<Point<u32>>>();
Expand Down
7 changes: 3 additions & 4 deletions src/binary_descriptors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<u32>>();

let mut new_hashmap = HashMap::<u128, Vec<&T>>::with_capacity(database.len());
Expand Down Expand Up @@ -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::<Vec<Point<u32>>>();
Expand Down

0 comments on commit ddd48c6

Please sign in to comment.