Function imageproc::geometric_transformations::warp_with
source · [−]pub fn warp_with<P, F>(
image: &Image<P>,
mapping: F,
interpolation: Interpolation,
default: P
) -> Image<P> where
F: Fn(f32, f32) -> (f32, f32) + Sync + Send,
P: Pixel + Send + Sync,
<P as Pixel>::Subpixel: Send + Sync,
<P as Pixel>::Subpixel: ValueInto<f32> + Clamp<f32>,
Expand description
Warps an image using the provided function to define the pre-image of each output pixel.
Examples
Applying a wave pattern.
use image::{ImageBuffer, Luma};
use imageproc::utils::gray_bench_image;
use imageproc::geometric_transformations::*;
let image = gray_bench_image(300, 300);
let warped = warp_with(
&image,
|x, y| (x, y + (x / 30.0).sin()),
Interpolation::Nearest,
Luma([0u8])
);