Files
wehub-resource-sync 3a2c66702c
Lint / TOML Format (push) Waiting to run
Tests on CPU (scheduled) / check-skip (push) Waiting to run
Tests on CPU (scheduled) / pre-tests (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-ubuntu (float32) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-ubuntu (float64) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float32, 2.5.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float32, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float64, 2.5.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float64, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float32, 2.5.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float32, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float64, 2.5.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float64, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.13, float32, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-windows (3.13, float64, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-mac (3.11, float32, 2.5.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-mac (3.11, float32, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-mac (3.12, float32, 2.5.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-mac (3.12, float32, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / tests-cpu-mac (3.13, float32, 2.9.1) (push) Blocked by required conditions
Tests on CPU (scheduled) / coverage (push) Blocked by required conditions
Tests on CPU (scheduled) / typing (push) Blocked by required conditions
Tests on CPU (scheduled) / tutorials (push) Blocked by required conditions
Tests on CPU (scheduled) / docs (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 12:49:27 +08:00

51 lines
2.1 KiB
ReStructuredText

kornia.io
=========
.. meta::
:name: description
:content: "The Kornia.io package provides utilities to load and save image data efficiently. It integrates with `kornia_rs`, a low-level Rust implementation for computer vision, and supports the DLPack protocol to reduce memory footprint. This package is designed for Linux platforms and requires PyTorch 1.10.0 or higher."
.. currentmodule:: kornia.io
Package to load and save image data.
The package internally implements `kornia_rs <https://github.com/kornia/kornia-rs>`_ which contains a low level implementation
for Computer Vision in the `Rust <https://www.rust-lang.org/>`_ language. In addition, we implement the `DLPack <https://github.com/dmlc/dlpack>`_ protocol
natively in Rust to reduce the memory footprint during the decoding and types conversion.
.. tip::
You need to ``pip install kornia_rs`` to use this package. For now we only support Linux platforms.
Contact us or sponsor the project for more support (mac, win, rust, c++, video and camera). See:
`https://opencollective.com/kornia <https://opencollective.com/kornia>`_
.. note::
The package needs at least PyTorch 1.10.0 installed.
.. code-block:: python
import kornia as K
from kornia.io import ImageLoadType
from kornia.core import Tensor
img: Tensor = K.io.load_image(file_path, ImageLoadType.UNCHANGED, device="cuda")
# will load CxHxW / in the original format in "cuda"
img: Tensor = K.io.load_image(file_path, ImageLoadType.RGB8, device="cpu")
# will load 3xHxW / in torch.uint in range [0,255] in "cpu"
img: Tensor = K.io.load_image(file_path, ImageLoadType.GRAY8, device="cuda")
# will load 1xHxW / in torch.uint8 in range [0,255] in "cuda"
img: Tensor = K.io.load_image(file_path, ImageLoadType.GRAY32, device="cpu")
# will load 1xHxW / in torch.float32 in range [0,1] in "cpu"
img: Tensor = K.io.load_image(file_path, ImageLoadType.RGB32, device="cuda")
# will load 3xHxW / in torch.float32 in range [0,1] in "cuda"
.. autofunction:: load_image
.. autofunction:: write_image
.. autoclass:: ImageLoadType
:members:
:undoc-members: