imgproc-rs
A Rust image processing library.
Features
- Multithreading support for some functions via rayon (see Enabling Multithreading for more information)
- SIMD support for some functions using AVX2
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.
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 ;
Multithreading
To enable multithreading, include the parallel feature in your Cargo.toml:
[]
= "0.3.0"
= false
= ["parallel"]
Alternatively, pass the features flag to cargo run:
cargo run --features parallel
Functions that support multithreading:
transformmodulecropscalescale_lanczos
- All functions in the
filtermodule, except:thresholdresidualmedian_filteralpha_trimmed_mean_filter
SIMD
SIMD support is enabled by default via the simd feature. Supported functions will only use SIMD where AVX2 is
supported (x86/x86_64); otherwise an alternate implementation is used.
Functions that support SIMD (outside simd module)
tone::brightness()tone::saturation()colorspace::rgb_to_grayscale()