[−][src]Function imageproc::map::map_pixels
pub fn map_pixels<I, P, Q, F>(image: &I, f: F) -> Image<Q> where
I: GenericImage<Pixel = P>,
P: Pixel,
Q: Pixel + 'static,
F: Fn(u32, u32, P) -> Q,
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);