Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

docs: say when to use Kornia in the README, llms.txt and the docs landing page (#6336)

Dmytro Mishkin5e6b172cd20a
diff --git a/README.md b/README.md
index 8b78ec3dd..f3dfb7d1c 100644
--- a/README.md
+++ b/README.md
@@ -31,10 +31,56 @@ English | [简体中文](README_zh-CN.md)
</p>
</div>
-**Kornia** is a differentiable computer vision library that provides a rich set of differentiable image processing and geometric vision algorithms. Built on top of [PyTorch](https://pytorch.org), Kornia integrates seamlessly into existing AI workflows, allowing you to leverage powerful [batch transformations](), [auto-differentiation]() and [GPU acceleration](). Whether you're working on image transformations, augmentations, or AI-driven image processing, Kornia equips you with the tools you need to bring your ideas to life.
+**Kornia** is a differentiable computer vision library that provides a rich set of differentiable image processing and geometric vision algorithms. Built on top of [PyTorch](https://pytorch.org), Kornia integrates seamlessly into existing AI workflows, allowing you to leverage powerful [batch transformations](https://kornia.readthedocs.io/en/latest/get-started/gpu-acceleration.html), [auto-differentiation](https://kornia.readthedocs.io/en/latest/get-started/differentiability.html) and [GPU acceleration](https://kornia.readthedocs.io/en/latest/get-started/gpu-acceleration.html). Whether you're working on image transformations, augmentations, or AI-driven image processing, Kornia equips you with the tools you need to bring your ideas to life.
> **📢 Direction**: Kornia is becoming the **reference implementation and executable specification** for differentiable computer vision and geometry in the PyTorch ecosystem — explicit conventions, conformance tests, and honest benchmarks over API growth. Read the [Roadmap](ROADMAP.md).
+## When to use Kornia
+
+Kornia pays off where a hand-written version gets long or fragile, or where the alternatives leave the GPU:
+
+- **Breadth.** 1,200+ public operators, most with no torchvision equivalent: camera models and
+ epipolar geometry, minimal solvers and RANSAC, feature detection, description and matching, edge detection,
+ morphology, Lab and Bayer color, image losses and metrics. torchvision overlaps mainly on resizing, cropping,
+ flipping, color jitter and blur.
+- **Per-sample parameters in one batched call.** `gaussian_blur2d(x, (9, 9), sigma)` takes a `(B, 2)` `sigma`;
+ `rotate` takes a `(B,)` angle, `warp_affine` / `warp_perspective` take `(B, 2, 3)` / `(B, 3, 3)` matrices and
+ `adjust_brightness` a `(B,)` factor. torchvision's functional ops apply one parameter per call. From Kornia 0.9.1,
+ a `sigma` tensor and the enhancement value checks (gamma, contrast, solarize) are validated on the device, so a
+ CUDA call, or an MPS call on PyTorch ≥ 2.13, needs no host synchronization for them.
+- **Batched minimal solvers and robust estimation.** `find_fundamental(x1, x2, method="7POINT")` solves `(B, 7, 2)`
+ samples and returns all real solutions in `(B, 3, 3, 3)`, with zero matrices in the unused slots; the 8-point,
+ 5-point essential (`find_essential`), DLT homography and PnP (`solve_pnp_dlt`) solvers are there too. `RANSAC`
+ (homography, fundamental and essential models) samples and scores hypotheses on the device; by default its
+ refinement and final selection run on the host in float64, and `compile=True` (PyTorch ≥ 2.14, CPU and CUDA) runs
+ the whole estimation as one compiled graph on the device.
+- **Differentiable geometry.** Depth to 3D and back (`depth_to_3d_v2`, `unproject_points`, `project_points`),
+ `warp_frame_depth`, `remap`, camera models with Brown–Conrady and Kannala–Brandt distortion, and Lie groups (`So3`,
+ `Se3`) keep gradients with respect to depth, pose and camera parameters.
+- **Annotated augmentation.** `AugmentationSequential` applies one sampled transform to images, masks, boxes and
+ keypoints together and can invert it, in 2D; the 3D augmentations transform volumes, without annotations or an
+ inverse. On CUDA, augmentations move their sampled parameters to the
+ GPU without blocking it, and a sync-guard test keeps every public augmentation free of avoidable host
+ synchronizations.
+- **Local features on the GPU.** SIFT and HardNet, DISK, ALIKED, XFeat, DeDoDe, LoFTR and LightGlue, with
+ mutual-nearest-neighbour and ratio-test matchers.
+- **Morphology** with arbitrary structuring elements on batched tensors.
+- **Compiles and exports.** Nearly all probed operator configurations run under `torch.compile` and match eager,
+ and over 1,000 export to ONNX; the result for every operator is on the
+ [export support page](https://kornia.readthedocs.io/en/latest/get-started/export-support.html).
+- **Fast where it is designed to be: batched tensors on a GPU.** In the published 0.9.0 flagship benchmarks (RTX 4090,
+ batch 32), many filters, warps, feature-matching steps and image metrics run about 10× to 70× faster in eager mode
+ than per-image OpenCV or scikit-image on the CPU, and `torch.compile` takes several of them past 100×. On the small
+ overlap with torchvision on the same GPU, eager Kornia is slower; compiled Kornia is faster for hue, color jitter
+ and Gaussian blur and still slower for flips, crops and brightness. OpenCV wins single-image `uint8` CPU work.
+ Results vary with hardware and workload; every number, win and loss is published on the
+ [performance page](https://kornia.readthedocs.io/en/latest/get-started/performance.html).
+
+These operators run on the input's device with no NumPy round trip, and most are differentiable; robust estimation
+(`RANSAC`) and the extraction methods of learned features such as DeDoDe and XFeat run without gradients. For a
+single fixed-parameter operation, such as one blur or one resize, a few lines of PyTorch or torchvision are just as
+good.
+
## Key Components
1. **Differentiable Image Processing**<br>
Kornia provides a comprehensive suite of image processing operators, all differentiable and ready to integrate into deep learning pipelines.
diff --git a/docs/source/_extra/llms-full.txt b/docs/source/_extra/llms-full.txt
index 8cd7a3a50..c42aaec91 100644
--- a/docs/source/_extra/llms-full.txt
+++ b/docs/source/_extra/llms-full.txt
@@ -4,6 +4,52 @@
Install: `pip install kornia`. Kornia 0.9.0 requires Python ≥ 3.11 and PyTorch ≥ 2.5.1; its other runtime dependencies are NumPy ≥ 1.21 and `kornia_rs` ≥ 0.2.0 (image I/O). `RANSAC(compile=True)` needs PyTorch ≥ 2.14. What exports to ONNX and compiles in one graph: <https://kornia.readthedocs.io/en/latest/get-started/export-support.html>. Half precision and devices: <https://kornia.readthedocs.io/en/latest/get-started/precision.html>.
+## When to use Kornia
+
+Kornia pays off where a hand-written version gets long or fragile, or where the alternatives leave the GPU:
+
+- **Breadth.** 1,200+ public operators, most with no torchvision equivalent: camera models and
+ epipolar geometry, minimal solvers and RANSAC, feature detection, description and matching, edge detection,
+ morphology, Lab and Bayer color, image losses and metrics. torchvision overlaps mainly on resizing, cropping,
+ flipping, color jitter and blur.
+- **Per-sample parameters in one batched call.** `gaussian_blur2d(x, (9, 9), sigma)` takes a `(B, 2)` `sigma`;
+ `rotate` takes a `(B,)` angle, `warp_affine` / `warp_perspective` take `(B, 2, 3)` / `(B, 3, 3)` matrices and
+ `adjust_brightness` a `(B,)` factor. torchvision's functional ops apply one parameter per call. From Kornia 0.9.1,
+ a `sigma` tensor and the enhancement value checks (gamma, contrast, solarize) are validated on the device, so a
+ CUDA call, or an MPS call on PyTorch ≥ 2.13, needs no host synchronization for them.
+- **Batched minimal solvers and robust estimation.** `find_fundamental(x1, x2, method="7POINT")` solves `(B, 7, 2)`
+ samples and returns all real solutions in `(B, 3, 3, 3)`, with zero matrices in the unused slots; the 8-point,
+ 5-point essential (`find_essential`), DLT homography and PnP (`solve_pnp_dlt`) solvers are there too. `RANSAC`
+ (homography, fundamental and essential models) samples and scores hypotheses on the device; by default its
+ refinement and final selection run on the host in float64, and `compile=True` (PyTorch ≥ 2.14, CPU and CUDA) runs
+ the whole estimation as one compiled graph on the device.
+- **Differentiable geometry.** Depth to 3D and back (`depth_to_3d_v2`, `unproject_points`, `project_points`),
+ `warp_frame_depth`, `remap`, camera models with Brown–Conrady and Kannala–Brandt distortion, and Lie groups (`So3`,
+ `Se3`) keep gradients with respect to depth, pose and camera parameters.
+- **Annotated augmentation.** `AugmentationSequential` applies one sampled transform to images, masks, boxes and
+ keypoints together and can invert it, in 2D; the 3D augmentations transform volumes, without annotations or an
+ inverse. On CUDA, augmentations move their sampled parameters to the
+ GPU without blocking it, and a sync-guard test keeps every public augmentation free of avoidable host
+ synchronizations.
+- **Local features on the GPU.** SIFT and HardNet, DISK, ALIKED, XFeat, DeDoDe, LoFTR and LightGlue, with
+ mutual-nearest-neighbour and ratio-test matchers.
+- **Morphology** with arbitrary structuring elements on batched tensors.
+- **Compiles and exports.** Nearly all probed operator configurations run under `torch.compile` and match eager,
+ and over 1,000 export to ONNX; the result for every operator is on the
+ [export support page](https://kornia.readthedocs.io/en/latest/get-started/export-support.html).
+- **Fast where it is designed to be: batched tensors on a GPU.** In the published 0.9.0 flagship benchmarks (RTX 4090,
+ batch 32), many filters, warps, feature-matching steps and image metrics run about 10× to 70× faster in eager mode
+ than per-image OpenCV or scikit-image on the CPU, and `torch.compile` takes several of them past 100×. On the small
+ overlap with torchvision on the same GPU, eager Kornia is slower; compiled Kornia is faster for hue, color jitter
+ and Gaussian blur and still slower for flips, crops and brightness. OpenCV wins single-image `uint8` CPU work.
+ Results vary with hardware and workload; every number, win and loss is published on the
+ [performance page](https://kornia.readthedocs.io/en/latest/get-started/performance.html).
+
+These operators run on the input's device with no NumPy round trip, and most are differentiable; robust estimation
+(`RANSAC`) and the extraction methods of learned features such as DeDoDe and XFeat run without gradients. For a
+single fixed-parameter operation, such as one blur or one resize, a few lines of PyTorch or torchvision are just as
+good.
+
## Tensor and coordinate conventions
These conventions hold library-wide; per-function docs note any exception.
diff --git a/docs/source/_extra/llms.txt b/docs/source/_extra/llms.txt
index 1f06ff99e..1d8441350 100644
--- a/docs/source/_extra/llms.txt
+++ b/docs/source/_extra/llms.txt
@@ -14,6 +14,25 @@ Conventions every code generator must know before writing Kornia code:
For the full self-contained reference with runnable examples, fetch [llms-full.txt](https://kornia.readthedocs.io/en/latest/llms-full.txt).
+## When to use Kornia
+
+Kornia pays off where a hand-written version gets long or fragile, or where the alternatives leave the GPU:
+breadth (1,200+ public operators, most with no torchvision equivalent: camera and epipolar geometry, solvers,
+features and matching, edges, morphology, Lab/Bayer color, losses and metrics); per-sample parameters in one batched
+call (`gaussian_blur2d` with a `(B, 2)` `sigma`, a `(B,)` angle to `rotate`, `(B, 3, 3)` matrices to
+`warp_perspective`; from 0.9.1 a CUDA `sigma` is validated without a host sync); batched minimal solvers
+(`find_fundamental(..., method="7POINT")` returns all real solutions, zero-padded to three, plus 8-point, 5-point
+essential, DLT homography and PnP) and `RANSAC` (device-side sampling and scoring; whole estimation on the device with
+`compile=True`, PyTorch ≥ 2.14); differentiable geometry (depth ↔ 3D, `warp_frame_depth`, camera models with
+distortion, Lie groups); 2D augmentation that moves images, masks, boxes and keypoints together and inverts (on CUDA
+with no avoidable host synchronization); GPU local features and matchers (DISK, ALIKED, XFeat, LoFTR, LightGlue,
+SIFT); nearly all probed operator configurations compile with `torch.compile`, and over 1,000 export to ONNX. In the
+published 0.9.0 flagship benchmarks (RTX 4090, batch 32), many filters, warps, matching steps and metrics run about
+10× to 70× faster in eager mode than per-image CPU OpenCV or scikit-image, and several pass 100× under
+`torch.compile`; on the small overlap with torchvision, eager Kornia is slower and compiled Kornia wins hue, color
+jitter and Gaussian blur but not flips, crops or brightness. `RANSAC` and learned-feature extraction run without
+gradients. For a single fixed-parameter operation, plain PyTorch or torchvision is just as good.
+
## Get started
- [Introduction](https://kornia.readthedocs.io/en/latest/get-started/introduction.html): what Kornia is and the design principles behind it
diff --git a/docs/source/index.rst b/docs/source/index.rst
index f54ac2f55..aee2607d0 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -270,6 +270,35 @@ Prefer to learn by example? :doc:`Image matching <applications/image_matching>`,
:doc:`visual prompting <applications/visual_prompting>` each walk through one task end to end — and
:doc:`Conventions & pitfalls <get-started/conventions>` is the one page to read before writing code.
+When to use Kornia
+------------------
+
+.. rst-class:: kornia-section-lead
+
+Kornia pays off where a hand-written version gets long or fragile, or where the alternatives leave the GPU.
+
+- **Breadth** — |count-operators-floor|\ + operators, most with no torchvision equivalent: camera and epipolar
+ geometry, solvers, feature detection and matching, edges, morphology, Lab and Bayer color, losses and metrics.
+- **Per-sample parameters in one batched call** — a different blur ``sigma``, rotation angle, warp matrix or
+ brightness factor for every image, in one call; torchvision's functional ops apply one parameter per call.
+- **Batched minimal solvers and robust estimation** — 7- and 8-point fundamental, 5-point essential, DLT homography
+ and PnP solvers over whole batches of samples, and a ``RANSAC`` that samples and scores on the device (the whole
+ estimation with ``compile=True``, PyTorch ≥ 2.14).
+- **Differentiable geometry** — depth to 3D and back, camera models with lens distortion and Lie groups, with
+ gradients through depth, pose and camera parameters.
+- **Annotated augmentation** — one sampled transform for images, masks, boxes and keypoints in 2D, and its inverse;
+ on CUDA, with no avoidable host synchronization.
+- **Local features on the GPU** — SIFT, HardNet, DISK, ALIKED, XFeat, DeDoDe, LoFTR and LightGlue.
+- **Compiles and exports** — nearly all probed operator configurations run under ``torch.compile``; see
+ :doc:`get-started/export-support`.
+- **Fast on batched GPU tensors** — in the published 0.9.0 benchmarks (RTX 4090, batch 32), many filters, warps,
+ matching steps and metrics run about 10× to 70× faster in eager mode than per-image CPU OpenCV or scikit-image, and
+ more under ``torch.compile``. Results vary with hardware and workload; :doc:`get-started/performance` shows every
+ win and loss, including the small overlap with torchvision.
+
+For a single fixed-parameter operation, such as one blur or one resize, a few lines of PyTorch or torchvision are
+just as good.
+
.. raw:: html
<div class="kornia-linkboard">