kornia/kornia-rs

🦀 Low-level 3D Computer Vision library in Rust

What it solves

Kornia-rs provides a high-performance, low-level computer vision library that bridges the gap between raw image data and machine learning models. It eliminates the overhead of host-to-device copies and GIL bottlenecks in Python, enabling real-time image processing pipelines that can run seamlessly on either the CPU or NVIDIA GPUs.

How it works

Built in Rust for memory and thread safety, the library uses a single API that automatically dispatches operations based on where the data resides. It leverages SIMD (NEON/AVX2) for CPU acceleration and custom CUDA kernels for GPU acceleration. For ML integration, it uses DLPack and the CUDA Array Interface to hand off tensors to PyTorch and TensorRT without copying data. A specialized Preprocessor fuses multiple steps—resizing, normalization, and format conversion (e.g., NV12 to CHW)—into a single CUDA kernel to maximize efficiency for inference pipelines.

Who it’s for

Developers building real-time computer vision applications, robotics engineers needing fast camera-to-model pipelines, and ML researchers who want Rust-level performance with Python bindings.

Highlights

  • Zero-copy interop: Direct handoff to PyTorch and TensorRT via DLPack.
  • Unified API: The same operators work on both CPU and GPU without requiring separate types.
  • Real-time optimized: Fused CUDA kernels for camera frame preprocessing.
  • Broad format support: Native support for a wide array of image formats including AVIF, OpenEXR, and PNG-16.
  • Python bindings: Full support for free-threaded Python (no GIL) via PyO3.