I really love to use Rust for everything I do, but there seem to be a lack of Image Processing libraries in Rust.
I have come across the bindings for opencv.
And the image and imageproc libraries by the PistonDevs.
But is that all?
I really love to use Rust for everything I do, but there seem to be a lack of Image Processing libraries in Rust.
I have come across the bindings for opencv.
And the image and imageproc libraries by the PistonDevs.
But is that all?
What kind of processing do you want to do?
I usually do low-level processing, so I use rgb and imgref, roll up my sleeves, and process every pixel (with rayon).
There's raster, which has a very simple API.
You can check the list below if you need FFI bindings to some popular C/C++ image processing and CV libraries. Most of them are fairly new though. Either lacking in documentation or not well-maintained (yet).
Tried a few of the above not quite satisfied with them, raster and image are the best IMO.
pixops seems to plan to have SIMD. It's still very new.
If you care about performance, there is https://github.com/bheisler/RustaCUDA -- I've managed to hit ~ 50-75% of GPU bandwidth using custom kernels together with that library.
How can I read and show Image in Rust?
I have done some coding in Python for Image Processing. I want to work in Rust.
Can someone share code? I have an error "Can't find crate" in this code. Should I have to install crate like OpenCV in python?
extern crate image;
use image::GenericImageView;
fn main() {
// Use the open function to load an image from a Path.
// open
returns a DynamicImage
on success.
let img = image::open("in.jpg").unwrap();
// The dimensions method returns the images width and height.
println!("dimensions {:?}", img.dimensions());
// The color method returns the image's `ColorType`.
println!("{:?}", img.color());
// Write the contents of this image to the Writer in PNG format.
img.save("test.png").unwrap();
}
The Book has a section on adding dependencies to a project.
That example uses the rand
crate, but in your case you'll want to use image instead.
Hi everyone!
It would be grateful if you could give me some basic hints on the problem I'm trying to solve:
I want to add a watermark image to another image.
I remember doing this on by-pixel basis about one or two years ago and it worked rather slowly.
Is there any means of blending images as a single operation? Which I hope will call some highly optimised C/unsafe-Rust function under the hood...
thank you for answering!
Have somebody tried GitHub - silvia-odwyer/photon: ⚡ Rust/WebAssembly image processing library ?
Photon is a high-performance image processing library, written in Rust and compilable to WebAssembly, which can be used both natively and on the web.
It allows developers to apply filters, effects and manipulate channels of their images, as well as apply standard image processing operations such as blurring, cropping, resizing, etc.,
What do you think about it?
It's fantastic IMO.
I've begun just days ago to explore the rust ecosystem, and I'm amazed by the stellar level of contributions. And of the language, of course....
Right now, I'm wetting my feet in diesel :), yew, scryer prolog and a few other.
Thank you for pointing out Silvia wonderful work.
There's several ways to scale, with the most efficient being GPU computation. That's exactly what OpenGL was made for. However, I'd recommend using one of the numerous crates which abstract away the details of OpenGL, for example piet. When using link time optimization, only the used functions will be extracted and no unused code will be included in your project.
If the cost of loading your images to the GPU are too high to make this an option, you can utilize SIMD parallelization in addition to multithreading.
Do you have some example repo?
The biggest projects I've done happen to be commercial, so I can't show them. But here's a small case:
https://github.com/kornelski/mss_saliency/blob/master/src/lib.rs
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.