Crates.io | climage |
lib.rs | climage |
version | 0.1.0 |
source | src |
created_at | 2022-12-12 14:18:56.377553 |
updated_at | 2022-12-12 14:18:56.377553 |
description | Rust implementation of image processing library with OpenCL. |
homepage | https://github.com/neka-nat/climage |
repository | https://github.com/neka-nat/climage |
max_upload_size | |
id | 735005 |
size | 166,540 |
Rust implementation of image processing library with OpenCL.
use climage;
use climage::ImageProc;
fn main() {
let context = climage::ClContext::default();
let mut blur = climage::GaussianBlur::new(&context, 2);
let img = climage::ClImageBuffer::from_readonly_host_image(
&context,
image::open("examples/lenna.png").unwrap().into_rgba8(),
);
let mut out = climage::ClImageBuffer::from_writeonly_host_image(
&context,
image::ImageBuffer::<image::Rgba<u8>, Vec<u8>>::new(img.dimensions().0, img.dimensions().1),
);
blur.build_kernel(&img, &mut out).run();
let mut out_img =
image::ImageBuffer::<image::Rgba<u8>, Vec<u8>>::new(out.dimensions().0, out.dimensions().1);
out.data.read(&mut out_img).enq().unwrap();
out_img.save("examples/lena_blur.png").unwrap();
}
cargo run --release --example gaussian_blur