From a57cb34b513876313c755be2bbebb63138b4932b Mon Sep 17 00:00:00 2001 From: gennyble Date: Mon, 10 Jun 2024 17:07:56 -0500 Subject: Add HighestBits selector to cli --- src/nih_kmeans.rs | 2 +- src/selection.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nih_kmeans.rs b/src/nih_kmeans.rs index ee752bc..36b17d1 100644 --- a/src/nih_kmeans.rs +++ b/src/nih_kmeans.rs @@ -91,7 +91,7 @@ impl KMeans { .unwrap() } - #[cfg(rand)] + #[cfg(feature = "rand")] fn get_centroid_seeds_random(&self, k: usize) -> Vec> { if k >= self.samples.len() { return self.samples.iter().map(|&v| v.into()).collect(); diff --git a/src/selection.rs b/src/selection.rs index 41e0254..84d5ea3 100644 --- a/src/selection.rs +++ b/src/selection.rs @@ -339,6 +339,7 @@ impl Selector for HighestBits { fn select(&mut self, max_colors: usize, image: ImageData) -> Vec { let max_bits = max_colors.next_power_of_two().ilog2() / 3; let shift = 8 - max_bits; + image .0 .iter() -- cgit 1.4.1-3-g733a5