Skip to content

Commit

Permalink
revert back to loop
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-ha458 committed Jan 7, 2024
1 parent 2b65437 commit a774da5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ocrs/src/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ fn greyscale_image<F: Fn(f32) -> f32>(

for y in 0..height {
for x in 0..width {
let pixel: f32 =
(0..used_chans).fold(0.2, |pixel, c| pixel + img[[c, y, x]] * chan_weights[c]);
let mut pixel = 0.;
for c in 0..used_chans {
pixel += img[[c, y, x]] * chan_weights[c];
}
out_lum_chan[[y, x]] = normalize_pixel(pixel);
}
}
Expand Down

0 comments on commit a774da5

Please sign in to comment.