This crate provides flexible image buffers
- Allows transforming known
Images(e.g. RGB32F) to typelessDynamicImagesand back (without a single buffer copy) - Ability to support buffers from other libraries like "opencv" without copying buffers
- Copy on write capability, so buffers can be reused if the internal representation allows it
- FFI compatible
Interleaved vs planar images
A 2x2 RGB image can either be interleaved (memory: rgbrgbrgbrgb) or planar(memory: rrrrggggbbbb)
Interleaved RGB images are stored as Image<[u8;3], 1>, whereas planar images are stored as Image<u8, 3>.
This crate provides utilities functions to go from one representation to the other.
Channels
[ImageChannel] is a composeable building block for [Image]. If you have a special Image kind, where channels are not uniform,
feel encouraged to add your own typed Image, which implement TryFrom<DynamicImage> and Into<DynamicImage>.
Typed Images
The Image struct represents a fully typed Image to support the most common image formats.
| Type | Description |
|---|---|
Image<u8, 3> |
RGB8 planar |
Image<[u8; 4], 1> |
RGBA8 interleaved |
Image<f32, 2> |
LUMAA32F planar |
ImageRef<u8, 1> |
LUMA8, where buffers are borrowed |
ImageMut<[u16;3], 1> |
RGB16 Interleaved, where buffers are mutually borrowed |
Example which demonstrates buffer reuse
use ;
use ;
#