2 个不稳定版本

0.3.0 2021 年 5 月 2 日
0.2.0 2021 年 4 月 20 日
0.1.3 2021 年 4 月 18 日

#784 in 图像

Apache-2.0

14KB
210

image-conv

Rust 图像卷积库


GitHub

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


示例用法

  • 应用水平 Sobel 滤波器
  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");
  }

一些示例输出

原始
Original
Sobel-X Sobel-Y
Sobel-X Sobel-Y
Scharr-X Scharr-Y
Scharr-X Scharr-Y
拉普拉斯 中值
Laplacian Median
高斯 去噪
Gaussian Denoise

依赖项

~32MB
~395K SLoC