Skip to content

Commit 4b3dd4d

Browse files
committed
Tweak for squaring error too much
1 parent ef433f3 commit 4b3dd4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mediancut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl<'hist> MBox<'hist> {
123123
pub fn prepare_color_weight_total(&mut self) -> f64 {
124124
let median = self.median_color();
125125
self.colors.iter_mut().map(move |a| {
126-
let w = median.diff(&a.color).sqrt() * (1. + a.adjusted_weight).sqrt();
126+
let w = (median.diff(&a.color).sqrt() * (2. + a.adjusted_weight)).sqrt();
127127
debug_assert!(w.is_finite());
128128
a.mc_color_weight = w;
129129
f64::from(w)

0 commit comments

Comments
 (0)