Skip to main content

Crate kornia_image

Crate kornia_image 

Source
Expand description

Image types and traits for generating and manipulating images

§Memory model

Image<T, C> is a thin wrapper over a kornia_tensor::Tensor3<T> and inherits its runtime memory model: there is no allocator/device type parameter. The backing TensorStorage records a memory domain (Host / Device / Unified) plus a runtime allocator handle; as_slice panics on a non-host-accessible (device) image. See the kornia_tensor crate docs for the full model.

§Unified constructor API

The common host case needs no allocator argument; _in variants take an explicit AllocHandle:

use kornia_image::{Image, ImageSize};

let size = ImageSize { width: 4, height: 3 };
let img = Image::<u8, 3>::from_size_val(size, 0)?;            // host default
let img2 = Image::<u8, 3>::new(size, vec![0u8; 4 * 3 * 3])?;  // host default

new/new_in, from_size_val/_in, and from_size_slice/_in follow the same host-default + _in pattern as kornia_tensor.

Re-exports§

pub use crate::color_spaces::ColorSpace;
pub use crate::color_spaces::DynImage;
pub use crate::error::ImageError;
pub use crate::image::Image;
pub use crate::image::ImageLayout;
pub use crate::image::ImageSize;
pub use crate::image::InterpolationMode;
pub use crate::image::PixelFormat;

Modules§

allocator
Allocator re-exports for backward compatibility.
color_spaces
Typed color-space wrappers and runtime color-space vocabulary. Runtime color-space vocabulary and typed color-space wrappers.
error
Error types for the image module.
image
image representation for computer vision purposes.
ops
module containing ops implementations.

Functions§

host_alloc
Returns the process-global host allocator handle.

Type Aliases§

AllocHandle
A cheaply-cloneable runtime allocator reference.