Crate image_conv[][src]

A Rust library for image convolution.

Example

use image_conv::conv;
use image_conv::{Filter, PaddingType};
use photon_rs::native::{open_image, save_image};

fn main() {
    // Open an image
    let mut img = open_image("img.jpg").expect("No such file found");

    // Create a filter
    let sobel_x: Vec<f32> = vec![1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0];
    let filter = Filter::from(sobel_x, 3, 3);
     
    // Apply convolution    
    let img_conv = conv::convolution(&img, filter, 1, PaddingType::UNIFORM(1));
    save_image(img_conv, "img_conv.jpg");
}

Modules

conv

Image convolution

Structs

Filter

Filter is a struct for holding a kernel and its associated meta-data

Enums

PaddingType

Enumeration for available padding types

Functions

dynamic_to_photon

For convertion of Dynamic image into PhotonImage

photon_to_dynamic

For convertion of PhotonImage into Dynamic image