image-conv

Crates.ioimage-conv
lib.rsimage-conv
version0.3.0
sourcesrc
created_at2021-04-18 12:12:34.1331
updated_at2021-05-02 02:28:47.142392
descriptionHigh performance image convolution library.
homepage
repositoryhttps://github.com/gp-97/image-conv
max_upload_size
id386118
size33,354
Gaurav Patel (gp-97)

documentation

README

image-conv

Rust library for image convolution.


GitHub

Status GitHub Issues GitHub Pull Requests Crates.io (recent) Github Workflow


Example usage

  • Apply horizontal Sobel filter:
  use image_conv::conv;
  use image_conv::{Filter, PaddingType};
  use photon_rs::native::{open_image, save_image};

  fn main() {
      // Open an image
      let 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");
  }

Some example ouputs

Original
Original
Sobel-X Sobel-Y
Sobel-X Sobel-Y
Scharr-X Scharr-Y
Scharr-X Scharr-Y
Laplacian Median
Laplacian Median
Gaussian Denoise
Gaussian Denoise
Commit count: 54

cargo fmt