[][src]Function raster::filter::convolve

pub fn convolve(
    src: &mut Image,
    matrix: [[i32; 3]; 3],
    divisor: i32
) -> RasterResult<()>

Apply a convolution matrix.

The divisor is applied as the last step of convolution.

Examples

use raster::filter;

// Create image from file
let mut image = raster::open("tests/in/sample.jpg").unwrap();
let matrix: [[i32; 3]; 3] = [
    [0, 0, 0],
    [0, 1, 0],
    [0, 0, 0]
];
filter::convolve(&mut image, matrix, 1).unwrap();
raster::save(&image, "tests/out/test_filter_convolve.jpg").unwrap();