🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
# Kornia — full reference for language models
> Kornia is a differentiable computer vision library for PyTorch. Classic CV operations (color, filtering, geometric transforms, camera/epipolar geometry, augmentation) are implemented as batched, GPU-ready, autograd-friendly tensor operations. Everything is `torch.Tensor` in, `torch.Tensor` out; OpenCV is not a dependency.
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. They run at their authors' speed or faster, except eager ALIKED
on CUDA (compile it) and SIFT on a CPU (OpenCV's is faster); what to use on each device is in the
[image matching guide](https://kornia.readthedocs.io/en/latest/applications/image_matching.html#feature-speed-by-device).
- **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.
- **Image layout:** float tensors `(B, C, H, W)`, channel order RGB, values in `[0, 1]`. The batched 4D layout is accepted everywhere; some op families (e.g. color conversions) also take `(*, C, H, W)` with arbitrary leading dims. When unsure, use `(B, C, H, W)` — add the batch dim with `img[None]`.
- **Point coordinates:** `(x, y)` order, where x indexes columns and y indexes rows. A point tensor for N points is `(B, N, 2)`.
- **Sizes:** output sizes and `dsize` arguments are `(h, w)` order — the OPPOSITE axis order from points.
- **Angles:** degrees in the 2D image APIs (`rotate`, `get_rotation_matrix2d`, `RandomRotation`); radians in the 3D/conversion APIs (`axis_angle_to_rotation_matrix`, `So3`; convert with `deg2rad`/`rad2deg`). Positive 2D angle = counter-clockwise rotation as displayed, with the origin at the top-left corner (OpenCV convention).
- **Transformation matrices:** batched. Homographies are `(B, 3, 3)`, affine matrices `(B, 2, 3)`. They act on pixel coordinates unless the function name or a flag says `normalized`. To apply a `(3, 3)` matrix, add the batch dim: `M[None]`. Exception: `homography_warp`, `homography_warp3d` and `HomographyWarper` take a destination→source homography, in normalized `[-1, 1]` coordinates by default (`normalized_coordinates=True`); `homography_warp(..., normalized_homography=False)` takes a pixel source→destination homography instead. For a pixel source→destination homography, as `RANSAC` and `find_homography_dlt` return it, use `warp_perspective`, or in 3D `warp_perspective3d(..., align_corners=True)`: its default `align_corners=False` resamples even an identity ([#4503](https://github.com/kornia/kornia/issues/4503)).
- **`align_corners`:** `warp_perspective` and `warp_affine` default to `align_corners=True`; `resize` defaults to `align_corners=None` (PyTorch's native default per interpolation mode). When mixing Kornia warps with `torch.nn.functional.interpolate` or `grid_sample`, pass `align_corners` explicitly everywhere.
- **Devices/dtypes:** ops run on whatever device/dtype the input tensors carry; there is no implicit `.cuda()` or `.float()`.
- **Augmentation probability:** most augmentations apply per sample with probability `p` and default to `p=0.5`: `RandomRotation(degrees=30.0)` leaves about half the batch unrotated. `RandomGrayscale` defaults to 0.1 and `RandomMosaic` to 0.7; every class exported from `kornia.augmentation` with a default below 1 states it on its first docstring line. These default to `p=1.0`: `CenterCrop`, `CenterCrop3D`, `ColorJiggle`, `ColorJitter`, `Denormalize`, `LongestMaxSize`, `Normalize`, `PatchMix`, `RandomAutoContrast`, `RandomBrightness`, `RandomContrast`, `RandomCrop`, `RandomCrop3D`, `RandomCutMixV2`, `RandomGamma`, `RandomHue`, `RandomJPEG`, `RandomMixUpV2`, `RandomResizedCrop`, `RandomSaturation`, `RandomSnow`, `Resize` and `SmallestMaxSize`. The crop, resize and mix classes (`RandomCrop`, `CenterCrop`, `RandomResizedCrop`, `Resize`, `LongestMaxSize`, `SmallestMaxSize`, `RandomCrop3D`, `CenterCrop3D`, `RandomMixUpV2`, `RandomCutMixV2`, `PatchMix`) take their `p` as one draw for the whole batch, `Normalize`, `Denormalize` and `RandomDissolving` share one draw across the batch, and `same_on_batch=True` shares the draw for any class. torchvision's `RandomRotation`, `RandomAffine`, `ElasticTransform`, `GaussianBlur`, `GaussianNoise` and `RandomChannelPermutation` always apply: pass `p=1.0` for that behaviour. The reverse holds for `RandomAutoContrast`, which defaults to `p=1.0` while torchvision's `RandomAutocontrast` defaults to `p=0.5`.
- **Pretrained models:** in `kornia.models` and `kornia.feature` alike, a model built with complete pretrained weights comes back in eval mode, and a randomly initialised or only partly pretrained one in training mode; call `.eval()` before inference on random weights, and after loading your own weights. In `kornia.feature`, `HardNet`, `HardNet8`, `HyNet`, `SOSNet`, `TFeat`, `OriNet`, `LAFAffNetShapeEstimator`, `KeyNet`, `KeyNetDetector` (its `KeyNet` network; the detector itself keeps its mode), `DeFMO`, `SOLD2`, `SOLD2_detector`, `LoFTR` and `LightGlue` load their pretrained weights by default (`pretrained=False`, or `None` for `LoFTR` and `LightGlue`, gives random ones), and `DISK`, `DeDoDe`, `ALIKED` and `XFeat` load them with `from_pretrained`.
Full conventions reference with runnable proofs: <https://kornia.readthedocs.io/en/latest/get-started/conventions.html>
Stability: the core modules (geometry, augmentation, color, filters, enhance, losses, metrics, morphology, io, image) follow a written deprecation policy — public symbols warn for at least one minor release before breaking: <https://kornia.readthedocs.io/en/latest/get-started/stability.html>
## kornia.geometry — warps, homographies, camera geometry
The differentiated core: differentiable, batched geometric transforms with no OpenCV/torchvision equivalent.
Key functions:
- `warp_perspective(src, M, dsize, mode="bilinear", padding_mode="zeros", align_corners=True)` — src `(B, C, H, W)`, M `(B, 3, 3)` pixel-coordinate homography, dsize `(h, w)`.
- `warp_affine(src, M, dsize, ...)` — M `(B, 2, 3)`.
- `get_perspective_transform(points_src, points_dst)` — both `(B, 4, 2)` in `(x, y)` pixel coords; returns `(B, 3, 3)` mapping src → dst.
- `get_rotation_matrix2d(center, angle, scale)` — center `(B, 2)` in `(x, y)`, angle `(B,)` degrees, scale `(B, 2)`; returns `(B, 2, 3)`.
- `rotate(tensor, angle)`, `translate`, `scale`, `resize(input, size, interpolation="bilinear", align_corners=None)`.
- Conversions: `rad2deg`, `deg2rad`, `axis_angle_to_rotation_matrix` (`angle_axis_to_rotation_matrix` is its deprecated alias), `rotation_matrix_to_quaternion`, and the `So3`/`Se3` Lie group classes.
- Epipolar: `find_fundamental`, `find_essential`, `sampson_epipolar_distance`, `triangulate_points`.
Example — warp an image with a 4-point homography:
```python
import torch
import kornia.geometry as KG
img = torch.rand(1, 3, 100, 100) # (B, C, H, W), values in [0, 1]
# four corners, (x, y) order, pixel coordinates
points_src = torch.tensor([[[0.0, 0.0], [99.0, 0.0], [99.0, 99.0], [0.0, 99.0]]])
points_dst = torch.tensor([[[10.0, 5.0], [90.0, 10.0], [95.0, 95.0], [5.0, 90.0]]])
M = KG.get_perspective_transform(points_src, points_dst) # (1, 3, 3)
out = KG.warp_perspective(img, M, dsize=(100, 100)) # dsize is (h, w)
```
## kornia.augmentation — batched augmentation with transform tracking
`AugmentationSequential` applies the SAME sampled transform to every registered data type and can invert it. This is the correct way to keep images, masks, boxes, and keypoints consistent.
```python
import torch
import kornia.augmentation as K
aug = K.AugmentationSequential(
K.RandomAffine(degrees=30.0, p=1.0),
K.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=1.0),
data_keys=["input", "mask", "keypoints"],
)
image = torch.rand(1, 3, 64, 64)
mask = (torch.rand(1, 1, 64, 64) > 0.5).float()
keypoints = torch.tensor([[[16.0, 16.0], [48.0, 32.0]]]) # (B, N, 2), (x, y)
img_out, mask_out, kpts_out = aug(image, mask, keypoints)
# geometric part is inverted for all data types; color ops are skipped on masks/keypoints
img_back, mask_back, kpts_back = aug.inverse(img_out, mask_out, kpts_out)
```
Notes:
- `data_keys` order defines the positional argument order.
- Random parameters are sampled per batch element, and most augmentations apply to each sample with probability `p=0.5` by default; `p=1.0` forces application.
- The last applied transform matrices are available via `aug.transform_matrix` after a forward pass.
## kornia.color — color space conversions
`rgb_to_grayscale`, `rgb_to_hsv`, `hsv_to_rgb`, `rgb_to_lab`, `rgb_to_yuv`, `bgr_to_rgb`, etc. All take `(B, C, H, W)` float tensors in `[0, 1]` (except explicitly-ranged spaces like LAB on output).
```python
import torch
import kornia.color as KC
rgb = torch.rand(1, 3, 32, 32)
gray = KC.rgb_to_grayscale(rgb) # (1, 1, 32, 32)
hsv = KC.rgb_to_hsv(rgb) # hue in radians [0, 2pi], s/v in [0, 1]
```
## kornia.filters — blurring, gradients, edges
- `gaussian_blur2d(input, kernel_size, sigma, border_type="reflect", separable=True)` — kernel_size `(ky, kx)` ints, sigma `(sy, sx)` floats or tensor.
- `sobel(input)`, `spatial_gradient(input)`, `canny(input)`, `median_blur`, `box_blur`, `bilateral_blur`.
```python
import torch
import kornia.filters as KF
img = torch.rand(1, 3, 64, 64)
blurred = KF.gaussian_blur2d(img, kernel_size=(5, 5), sigma=(1.5, 1.5))
magnitude, edges = KF.canny(img) # gradient magnitudes and thresholded edge map
```
## kornia.feature — detection, description, matching
Classical and learned local features with a common interface: LAFs (local affine frames) of shape `(B, N, 2, 3)`.
```python
import torch
import kornia.feature as KF
# LoFTR-style dense matching (downloads pretrained weights at construction)
matcher = KF.LoFTR(pretrained="outdoor")
input_dict = {
"image0": torch.rand(1, 1, 128, 128), # grayscale (B, 1, H, W)
"image1": torch.rand(1, 1, 128, 128),
}
with torch.inference_mode():
out = matcher(input_dict)
# out["keypoints0"], out["keypoints1"]: matched (x, y) pixel coords; out["confidence"]
```
Other entry points: `SIFTDescriptor`, `HardNet`, `DISK`, `LightGlueMatcher`, `match_smnn`, `LAFDescriptor`.
## kornia.enhance / kornia.losses / kornia.metrics / kornia.morphology
- `kornia.enhance`: `normalize`, `denormalize`, `equalize_clahe`, `adjust_gamma`, `adjust_brightness` — all differentiable.
- `kornia.losses`: `ssim_loss`, `psnr_loss`, `dice_loss`, `focal_loss`, `charbonnier_loss` — take `(B, C, H, W)` predictions/targets.
- `kornia.metrics`: `ssim`, `psnr`, `mean_iou`, `accuracy`.
- `kornia.morphology`: `dilation(tensor, kernel)`, `erosion`, `opening`, `closing` — kernel is a 2D `(kH, kW)` tensor of ones/zeros.
## kornia.io — image I/O
```python
import kornia.io as KIO
img = KIO.load_image("photo.jpg", KIO.ImageLoadType.RGB32) # (3, H, W) float32 in [0, 1]
img = img[None] # most ops want (B, C, H, W)
```
## Pitfalls checklist
1. Passing `(H, W, C)` NumPy-style arrays — convert with `kornia.image.image_to_tensor(np_img)[None]` (or `torch.from_numpy(...).permute(2, 0, 1)[None] / 255`). `kornia.utils.image_to_tensor` is deprecated.
2. Passing `(w, h)` to `dsize`/`size` arguments — they are `(h, w)`.
3. Passing `(y, x)` (row, col) points — point tensors are `(x, y)`.
4. Assuming `align_corners` defaults are uniform — warps default `True`, `resize` defaults `None`.
5. Using an unbatched `(3, 3)` homography — add the batch dim: `M[None]`.
6. Radians where degrees are expected — rotation angles are degrees.
7. Uint8 `[0, 255]` tensors — ops expect float `[0, 1]`; divide by 255 first.
8. Augmenting image and mask through two separate augmentation calls — the random parameters will differ; use one `AugmentationSequential` with `data_keys`.
9. Feeding `homography_warp` a source→destination pixel homography — it expects destination→source, normalized to [-1, 1]. Use `warp_perspective` (or `normalized_homography=False`) instead. To keep the normalized form, normalize the forward homography FIRST with the `align_corners` the warp uses, then invert: `torch.inverse(normalize_homography(M, size_src, size_dst, align_corners=False))` for `homography_warp`'s default `align_corners=False`, which differs from `warp_perspective`'s `True`.
10. Mixing `axis_angle_to_rotation_matrix` (right-hand rule, math convention — screen-clockwise for +z on y-down images) with `rotate` (screen-counter-clockwise) without negating the angle.
11. Treating `kornia.geometry.bbox.infer_bbox_shape` width/height as exclusive — they are inclusive (`x_right - x_left + 1`): corners (1,1),(2,2) give width 2.
12. Quaternions in XYZW order — `kornia.geometry.quaternion.Quaternion` uses WXYZ (scalar first).
13. Expecting hue in `[0, 360]` or `[0, 1]` — `rgb_to_hsv` returns radians `[0, 2π)`.
14. Wrong `data_keys` box format — `"bbox"` means 4-corner `(B, 4, 2)`; coordinate formats are `"bbox_xyxy"` / `"bbox_xywh"`.
15. Treating `kornia.geometry.boxes.Boxes` as exclusive — it stores boxes inclusive (`width = xmax - xmin + 1`, unlike torchvision, COCO and albumentations); the `"xyxy"` / `"xywh"` modes are exclusive and converted by `from_tensor` / `to_tensor` ([#3934](https://github.com/kornia/kornia/issues/3934)). `nms` takes exclusive `xyxy`.
16. Normalized `[0, 1]` boxes through `Boxes` — the inclusive conversion subtracts 1 and corrupts sub-unit extents ([#4061](https://github.com/kornia/kornia/issues/4061)); convert to pixels first.
17. Assuming `RandomAffine(degrees=...)` turns like `rotate` — a positive angle turns the image clockwise in `RandomAffine` but counter-clockwise in `rotate` and `RandomRotation` ([#4408](https://github.com/kornia/kornia/issues/4408)).
18. Assuming one `align_corners` default across augmentations — it is `True` for `RandomRotation`, `RandomRotation90` and the crop/resize classes, and `False` for `RandomAffine`, `RandomShear`, `RandomTranslate`, `RandomPerspective`, `RandomElasticTransform` and `RandomThinPlateSpline` ([#4412](https://github.com/kornia/kornia/issues/4412)); pass it explicitly when the pixel grid matters.
## Performance (auto-refreshed from benchmarks/results)
From the in-repo benchmark harness (`benchmarks/` in the GitHub repo — warmup + repeats, median wall clock, device sync, recorded hardware metadata; see `benchmarks/README.md`). Guidance for choosing a backend, not marketing; numbers vary by hardware — reproduce with `python benchmarks/geometry/flagship.py --json out.json` before citing:
How to choose a regime:
- Kornia's regime is batched float tensors on an accelerator, differentiable end-to-end: use it for batched, GPU or differentiable pipelines.
- OpenCV wins the CPU single-image uint8 regime on image warps and resize: use OpenCV or kornia-rs for per-image CPU data loading.
- `torch.compile` speeds many ops but not all, and the first call pays the compile time: measure your own shapes before assuming it helps.
- On Apple-silicon MPS, measure the specific op you need: a few ops take slow paths on MPS.
The result block below lists, per machine, only each suite's fastest and slowest row; the per-op tables are on the performance page: <https://kornia.readthedocs.io/en/latest/get-started/performance.html>.
<!-- BENCH:BEGIN -->
- Result set: kornia 0.9.0, committed in `benchmarks/results/0.9.0/` (per-machine
snapshots; reproduce with `python benchmarks/<dir>/<script>.py --contribute benchmarks/results`,
the script each suite maps to in `benchmarks/README.md`).
- augmentation on apple-m1-pro/cpu (kornia 0.9.0 @ e674077f, 2026-10-23): fastest overall opencv RandomGrayscale@32 at 101730 img/s; slowest kornia op ColorJiggle@1 at 249 img/s.
- augmentation on apple-m1-pro/mps (kornia 0.9.0 @ e674077f, 2026-10-23): fastest overall opencv RandomGrayscale@8 at 100247 img/s; slowest kornia op ColorJiggle@1 at 210 img/s.
- augmentation on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ e674077f9, 2026-10-23): fastest overall opencv RandomHorizontalFlip@1 at 281891 img/s; slowest kornia op ColorJiggle@32 at 454 img/s.
- augmentation on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ e674077f9, 2026-10-23): fastest overall torchvision v2 RandomHorizontalFlip@32 at 1851739 img/s; slowest kornia op RandomPerspective@1 at 502 img/s.
- color on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall opencv (stacked) rgb_to_grayscale@32 at 311995 img/s; slowest kornia op rgb_to_lab@1 at 679 img/s.
- color on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall opencv (stacked) rgb_to_grayscale@32 at 303264 img/s; slowest kornia op rgb_to_lab@1 at 793 img/s.
- color on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv (stacked) rgb_to_grayscale@8 at 263849 img/s; slowest kornia op rgb_to_lab@32 at 500 img/s.
- color on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall torchvision v2 rgb_to_grayscale@32 at 1054836 img/s; slowest kornia op rgb_to_lab@32 at 504 img/s.
- contrib on apple-m1-pro/cpu (kornia 0.9.0 @ e674077f, 2026-10-23): fastest overall kornia-rs connected_components_union_find@1 at 14209 img/s; slowest kornia op distance_transform@1 at 13 img/s.
- contrib on apple-m1-pro/mps (kornia 0.9.0 @ e674077f, 2026-10-23): fastest overall kornia-rs connected_components_union_find@1 at 14489 img/s; slowest kornia op distance_transform@1 at 91 img/s.
- contrib on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv connected_components_union_find@1 at 34965 img/s; slowest kornia op distance_transform@32 at 15 img/s.
- contrib on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv connected_components_union_find@1 at 36035 img/s; slowest kornia op distance_transform@1 at 141 img/s.
- enhance on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (compiled) normalize@32 at 52849 img/s; slowest kornia op equalize_clahe@1 at 352 img/s.
- enhance on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (compiled) normalize@32 at 52980 img/s; slowest kornia op equalize_clahe@32 at 143 img/s.
- enhance on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) normalize@8 at 97253 img/s; slowest kornia op equalize_clahe@32 at 319 img/s.
- enhance on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall torchvision v2 adjust_gamma@32 at 1917808 img/s; slowest kornia op equalize_clahe@1 at 832 img/s.
- feature on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall opencv harris_response@1 at 4367 items/s; slowest kornia op SIFTFeature@1 at 11 items/s.
- feature on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (compiled) harris_response@32 at 13831 items/s; slowest kornia op match_smnn_batched@8 at 13 items/s.
- feature on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv harris_response@1 at 4785 items/s; slowest kornia op SIFTFeature@1 at 20 items/s.
- feature on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) gftt_response@32 at 157305 items/s; slowest kornia op SIFTFeature@1 at 30 items/s.
- feature-laf-ops on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (compiled) laf_is_inside_image@1,n_lafs=20000 at 229900477 LAFs/s; slowest kornia op extract_patches_from_pyramid@1,n_lafs=2000 at 38708 LAFs/s.
- feature-laf-ops on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (compiled) laf_is_inside_image@1,n_lafs=20000 at 82034032 LAFs/s; slowest kornia op extract_patches_from_pyramid@1,n_lafs=2000 at 106876 LAFs/s.
- feature-laf-ops on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) laf_is_inside_image@1,n_lafs=20000 at 1050248510 LAFs/s; slowest kornia op extract_patches_from_pyramid@8,n_lafs=2000 at 80344 LAFs/s.
- feature-laf-ops on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) laf_is_inside_image@1,n_lafs=20000 at 592275800 LAFs/s; slowest kornia op extract_patches_from_pyramid@1,n_lafs=2000 at 1324566 LAFs/s.
- filters on apple-m1-pro/cpu (kornia 0.9.0 @ e674077f, 2026-10-23): fastest overall kornia-rs box_blur@1 at 24130 img/s; slowest kornia op median_blur@1 at 120 img/s.
- filters on apple-m1-pro/mps (kornia 0.9.0 @ e674077f, 2026-10-23): fastest overall kornia (compiled) box_blur_separable@32 at 36826 img/s; slowest kornia op median_blur@1 at 48 img/s.
- filters on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ e674077f9, 2026-10-23): fastest overall opencv gaussian_blur2d@8 at 48160 img/s; slowest kornia op median_blur@32 at 91 img/s.
- filters on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ e674077f9, 2026-10-23): fastest overall kornia (compiled) laplacian@32 at 339683 img/s; slowest kornia op median_blur@8 at 269 img/s.
- geometry on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (compiled) get_perspective_transform@32 at 1049180 items/s; slowest kornia op warp_perspective@1 at 913 items/s.
- geometry on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall opencv get_perspective_transform@32 at 877535 items/s; slowest kornia op rotate_shared@1 at 820 items/s.
- geometry on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv get_perspective_transform@32 at 1121249 items/s; slowest kornia op remap@32 at 1632 items/s.
- geometry on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall torchvision v2 resize@32 at 1394045 items/s; slowest kornia op get_perspective_transform@1 at 1010 items/s.
- io on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall torchvision load_jpeg@1 at 4536 img/s; slowest kornia op load_png@1 at 1131 img/s.
- io on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall opencv load_jpeg@1 at 4231 img/s; slowest kornia op load_png@32 at 870 img/s.
- io on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv load_jpeg@1 at 6797 img/s; slowest kornia op load_png@32 at 2661 img/s.
- io on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv load_jpeg@1 at 6699 img/s; slowest kornia op load_png@8 at 1402 img/s.
- losses on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (eager) total_variation@8 at 3854 img/s; slowest kornia op ssim_loss@32 at 20 img/s.
- losses on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (compiled) binary_focal_loss_with_logits@32 at 24274 img/s; slowest kornia op dice_loss@8 at 228 img/s.
- losses on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) total_variation@32 at 8372 img/s; slowest kornia op ssim_loss@32 at 82 img/s.
- losses on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) total_variation@32 at 129031 img/s; slowest kornia op ssim_loss@1 at 520 img/s.
- metrics on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (eager) psnr@32 at 31691 img/s; slowest kornia op ssim@32 at 27 img/s.
- metrics on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall kornia (eager) psnr@32 at 50259 img/s; slowest kornia op ssim@1 at 379 img/s.
- metrics on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) psnr@8 at 68457 img/s; slowest kornia op ssim@32 at 309 img/s.
- metrics on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) psnr@32 at 544945 img/s; slowest kornia op ssim@1 at 1026 img/s.
- morphology on apple-m1-pro/cpu (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall opencv dilation@1 at 24319 img/s; slowest kornia op gradient@1 at 125 img/s.
- morphology on apple-m1-pro/mps (kornia 0.9.0 @ 52e3397a, 2026-10-22): fastest overall opencv erosion@32 at 24315 img/s; slowest kornia op gradient@32 at 125 img/s.
- morphology on i7-14700k-rtx-4090/cpu (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall opencv erosion@1 at 64368 img/s; slowest kornia op gradient@32 at 189 img/s.
- morphology on i7-14700k-rtx-4090/cuda (kornia 0.9.0 @ 52e3397aa, 2026-10-22): fastest overall kornia (compiled) erosion@32 at 190489 img/s; slowest kornia op gradient@1 at 180 img/s.
<!-- BENCH:END -->
## Links
- Docs: <https://kornia.readthedocs.io/en/latest/>
- Machine-readable index: <https://kornia.readthedocs.io/en/latest/llms.txt>
- Source: <https://github.com/kornia/kornia>
- Tutorials: <https://www.kornia.org/tutorials/>