pub fn map_pixels<I, P, Q, F>(image: &I, f: F) -> Image<Q>
Expand description
Applies f
to each pixel in the input image.
ยงExamples
use image::Rgb;
use imageproc::map::map_pixels;
let image = gray_image!(
1, 2;
3, 4);
let rgb = rgb_image!(
[1, 0, 0], [2, 1, 0];
[3, 0, 1], [4, 1, 1]);
assert_pixels_eq!(
map_pixels(&image, |x, y, p| {
Rgb([p[0], x as u8, y as u8])
}),
rgb);