imgproc-rs
A Rust image processing library.
Features
- Multithreading support for some functions via rayon (see Enabling Multithreading for more information)
Supported Image Formats
imgproc-rs uses the i/o functions provided in the image crate. A list of
supported image formats can be found here.
Notes
Running with the release profile greatly increases performance:
cargo run --release
Examples
Reading and Writing Images
use io;
Creating Images
Images can be created from existing vectors, slices, vectors of vectors, and vectors of slices. A few examples are shown below.
use ;
Getting Image Information
use io;
use ;
Getting/Setting Image Pixels
Image pixels can be accessed using either 1D or 2D indexing. 1D indexing reads the image data row by row from left to right, starting in the upper left corner of the image. 2D coordinates start at zero in the upper left corner of the image and increase downwards and to the right.
use io;
use ;
Enabling Multithreading
To enable multithreading, include the parallel feature in your Cargo.toml:
[]
= "0.2.2"
= false
= ["parallel"]
Alternatively, pass the features flag to cargo run:
cargo run --features parallel
Image processing functions that support multithreading:
transformmodulecropscalescale_lanczos
- All functions in the
filtermodule, except:thresholdresidualmedian_filteralpha_trimmed_mean_filter