Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix different warning and errors when building doc (#2127)

João Gustavo A. Amorima9809e36f020
diff --git a/docs/generate_example_images.py b/docs/generate_example_images.py
index ae537891c..d3542ec8e 100644
--- a/docs/generate_example_images.py
+++ b/docs/generate_example_images.py
@@ -64,18 +64,23 @@ def main():
augmentations_list: dict = {
"CenterCrop": ((184, 184), 1, 2018),
"ColorJiggle": ((0.3, 0.3, 0.3, 0.3), 2, 2018),
+ "ColorJitter": ((0.3, 0.3, 0.3, 0.3), 2, 2022),
"PadTo": (((220, 450),), 1, 2022),
"RandomAffine": (((-15.0, 20.0), (0.1, 0.1), (0.7, 1.3), 20), 2, 2019),
"RandomBoxBlur": (((7, 7),), 1, 2020),
+ "RandomBrightness": (((0.0, 1.0),), 2, 2022),
+ "RandomContrast": (((0.0, 1.0),), 2, 2022),
"RandomCrop": ((img1.shape[-2:], (50, 50)), 2, 2020),
"RandomChannelShuffle": ((), 1, 2020),
"RandomElasticTransform": (((63, 63), (32, 32), (2.0, 2.0)), 2, 2018),
"RandomEqualize": ((), 1, 2020),
"RandomErasing": (((0.2, 0.4), (0.3, 1 / 0.3)), 2, 2017),
"RandomFisheye": ((torch.tensor([-0.3, 0.3]), torch.tensor([-0.3, 0.3]), torch.tensor([0.9, 1.0])), 2, 2020),
+ "RandomGamma": (((0.0, 1.0),), 2, 2022),
"RandomGaussianBlur": (((3, 3), (0.1, 2.0)), 1, 2020),
"RandomGaussianNoise": ((0.0, 0.05), 1, 2020),
"RandomGrayscale": ((), 1, 2020),
+ "RandomHue": (((-0.5, 0.5),), 2, 2022),
"RandomHorizontalFlip": ((), 1, 2020),
"RandomInvert": ((), 1, 2020),
"RandomMotionBlur": ((7, 35.0, 0.5), 2, 2020),
@@ -87,6 +92,7 @@ def main():
"RandomPosterize": (((1, 4),), 2, 2016),
"RandomResizedCrop": ((img1.shape[-2:], (1.0, 2.0), (1.0, 2.0)), 2, 2020),
"RandomRotation": ((45.0,), 2, 2019),
+ "RandomSaturation": (((0.5, 5.0),), 2, 2022),
"RandomSharpness": ((16.0,), 1, 2019),
"RandomSolarize": ((0.2, 0.2), 2, 2019),
"RandomVerticalFlip": ((), 1, 2020),
diff --git a/docs/source/applications/image_denoising.rst b/docs/source/applications/image_denoising.rst
index 292b95c0e..cb9438df3 100644
--- a/docs/source/applications/image_denoising.rst
+++ b/docs/source/applications/image_denoising.rst
@@ -1,2 +1,8 @@
+Image Denoising
+===============
+
+
+
.. raw:: html
- :file: gradio/total_variation_denoising.html
+
+ <gradio-app space="kornia/total_variation_denoising"></gradio-app>
diff --git a/docs/source/applications/image_registration.rst b/docs/source/applications/image_registration.rst
index 57f2573ca..544b8e2a9 100644
--- a/docs/source/applications/image_registration.rst
+++ b/docs/source/applications/image_registration.rst
@@ -26,6 +26,8 @@ To reproduce the same results as in the showed video you can go through or full
Interactive Demo
----------------
.. raw:: html
- :file: gradio/image_registration.html.html
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/image-registration-with-kornia>`_.
+ <gradio-app space="kornia/image-registration-with-kornia"></gradio-app>
+
+
+Visit the `image registration demo on the Hugging Face Spaces <https://huggingface.co/spaces/kornia/image-registration-with-kornia>`_.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index bffe01675..b09586783 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -92,7 +92,7 @@ release = version
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
-language = None
+language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
diff --git a/docs/source/filters.rst b/docs/source/filters.rst
index 75d8252b4..5cf8f436f 100644
--- a/docs/source/filters.rst
+++ b/docs/source/filters.rst
@@ -22,7 +22,8 @@ Interactive Demo
<gradio-app space="kornia/kornia-image-filtering"></gradio-app>
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/kornia-image-filtering>`_.
+Visit the `Kornia image filtering demo on the Hugging Face Spaces
+<https://huggingface.co/spaces/kornia/kornia-image-filtering>`_.
Edge detection
--------------
@@ -48,7 +49,8 @@ Interactive Demo
<gradio-app space="kornia/edge_detector"></gradio-app>
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/edge_detector>`_.
+Visit the `Kornia edge detector demo on the Hugging Face Spaces
+<https://huggingface.co/spaces/kornia/edge_detector>`_.
Filtering API
diff --git a/docs/source/geometry.conversions.rst b/docs/source/geometry.conversions.rst
index 92934d3c7..2ad4bf03f 100644
--- a/docs/source/geometry.conversions.rst
+++ b/docs/source/geometry.conversions.rst
@@ -57,8 +57,8 @@ Angle Axis
Euler Angles
------------
-.. autofuction:: quaternion_from_euler
-.. autofuction:: euler_from_quaternion
+.. autofunction:: quaternion_from_euler
+.. autofunction:: euler_from_quaternion
Pose
----------
diff --git a/docs/source/geometry.line.rst b/docs/source/geometry.line.rst
index 00c9da877..138b52a38 100644
--- a/docs/source/geometry.line.rst
+++ b/docs/source/geometry.line.rst
@@ -10,12 +10,11 @@ kornia.geometry.line
.. autofunction:: fit_line
.. autoclass:: Hyperplane
-.. raw:: html
- :file: gradio/line_fitting.html
Interactive Demo
----------------
+
.. raw:: html
<gradio-app space="kornia/line-segment-matching"></gradio-app>
diff --git a/docs/source/geometry.transform.rst b/docs/source/geometry.transform.rst
index b2be110be..901d1f7d0 100644
--- a/docs/source/geometry.transform.rst
+++ b/docs/source/geometry.transform.rst
@@ -94,5 +94,10 @@ Interactive Demo
----------------
.. raw:: html
- :file: gradio/resize_antialias.html
- :file: gradio/geometry_image_transform.html
+
+ <gradio-app space="kornia/kornia-resize-antialias"></gradio-app>
+
+
+.. raw:: html
+
+ <gradio-app space="kornia/geometry_image_transform_with_kornia"></gradio-app>
diff --git a/docs/source/gradio/geometry_image_transform.html b/docs/source/gradio/geometry_image_transform.html
deleted file mode 100644
index 1e5a23ee6..000000000
--- a/docs/source/gradio/geometry_image_transform.html
+++ /dev/null
@@ -1 +0,0 @@
-<iframe src="https://hf.space/embed/kornia/geometry_image_transform_with_kornia/+"></iframe>
diff --git a/docs/source/gradio/image_registration.html b/docs/source/gradio/image_registration.html
deleted file mode 100644
index 7b110700e..000000000
--- a/docs/source/gradio/image_registration.html
+++ /dev/null
@@ -1 +0,0 @@
-<iframe src="https://hf.space/embed/kornia/image-registration-with-kornia/+"></iframe>
diff --git a/docs/source/gradio/total_variation_denoising.html b/docs/source/gradio/total_variation_denoising.html
deleted file mode 100644
index 806c2ded6..000000000
--- a/docs/source/gradio/total_variation_denoising.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<script type="module"
-src="https://gradio.s3-us-west-2.amazonaws.com/3.3/gradio.js">
-</script>
-<gradio-app space="kornia/total_variation_denoising"></gradio-app>
diff --git a/docs/source/index.rst b/docs/source/index.rst
index acc5c54a6..d4982f1eb 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -61,6 +61,7 @@ Join the community
applications/image_stitching
applications/image_registration
applications/semantic_segmentation
+ applications/image_denoising
.. toctree::
:caption: KORNIA MODELS
diff --git a/docs/source/models/dexined.rst b/docs/source/models/dexined.rst
index 4bd680204..5b7a049c3 100644
--- a/docs/source/models/dexined.rst
+++ b/docs/source/models/dexined.rst
@@ -1,7 +1,7 @@
.. _dexined_model:
Dexined (edge detection)
-.....
+------------------------
.. card::
:link: https://www.computer.org/csdl/proceedings-article/wacv/2020/09093290/1jPbjFHmwi4
diff --git a/docs/source/references.bib b/docs/source/references.bib
index 674253071..f0291da4e 100644
--- a/docs/source/references.bib
+++ b/docs/source/references.bib
@@ -258,3 +258,21 @@ month = {mar}
year={1987},
publisher={Elsevier}
}
+
+@article{AdaLAM2020,
+ author = {Luca Cavalli and
+ Viktor Larsson and
+ Martin Ralf Oswald and
+ Torsten Sattler and
+ Marc Pollefeys},
+ title = {AdaLAM: Revisiting Handcrafted Outlier Detection},
+ journal = {CoRR},
+ volume = {abs/2006.04250},
+ year = {2020},
+ url = {https://arxiv.org/abs/2006.04250},
+ eprinttype = {arXiv},
+ eprint = {2006.04250},
+ timestamp = {Fri, 12 Jun 2020 14:02:57 +0200},
+ biburl = {https://dblp.org/rec/journals/corr/abs-2006-04250.bib},
+ bibsource = {dblp computer science bibliography, https://dblp.org}
+}
diff --git a/kornia/augmentation/_2d/intensity/brightness.py b/kornia/augmentation/_2d/intensity/brightness.py
index 93166d191..824964944 100644
--- a/kornia/augmentation/_2d/intensity/brightness.py
+++ b/kornia/augmentation/_2d/intensity/brightness.py
@@ -12,7 +12,7 @@ class RandomBrightness(IntensityAugmentationBase2D):
This implementation aligns PIL. Hence, the output is close to TorchVision.
- .. image:: _static/img/RandomBrighness.png
+ .. image:: _static/img/RandomBrightness.png
Args:
p: probability of applying the transformation.
@@ -29,7 +29,7 @@ class RandomBrightness(IntensityAugmentationBase2D):
.. note::
This function internally uses :func:`kornia.enhance.adjust_brightness`
- Examples:
+ Examples:
>>> rng = torch.manual_seed(0)
>>> inputs = torch.rand(1, 3, 3, 3)
>>> aug = RandomBrightness(brightness = (0.5,2.),p=1.)
@@ -47,6 +47,7 @@ class RandomBrightness(IntensityAugmentationBase2D):
[0.0000, 0.1072, 0.5070]]]])
To apply the exact augmenation again, you may take the advantage of the previous parameter state:
+
>>> input = torch.rand(1, 3, 32, 32)
>>> aug = RandomBrightness((0.8,1.2), p=1.)
>>> (aug(input) == aug(input, params=aug._params)).all()
diff --git a/kornia/augmentation/_2d/intensity/color_jitter.py b/kornia/augmentation/_2d/intensity/color_jitter.py
index 39d3849b3..5f50219f9 100644
--- a/kornia/augmentation/_2d/intensity/color_jitter.py
+++ b/kornia/augmentation/_2d/intensity/color_jitter.py
@@ -60,6 +60,7 @@ class ColorJitter(IntensityAugmentationBase2D):
[0.9993, 0.9993, 0.9993]]]])
To apply the exact augmenation again, you may take the advantage of the previous parameter state:
+
>>> input = torch.randn(1, 3, 32, 32)
>>> aug = ColorJitter(0.1, 0.1, 0.1, 0.1, p=1.)
>>> (aug(input) == aug(input, params=aug._params)).all()
diff --git a/kornia/augmentation/_2d/intensity/contrast.py b/kornia/augmentation/_2d/intensity/contrast.py
index 9446e1042..c811f9bdf 100644
--- a/kornia/augmentation/_2d/intensity/contrast.py
+++ b/kornia/augmentation/_2d/intensity/contrast.py
@@ -27,12 +27,12 @@ class RandomContrast(IntensityAugmentationBase2D):
- Output: :math:`(B, C, H, W)`
.. note::
- This function internally uses :func:`kornia.enhance.adjust_contrast
+ This function internally uses :func:`kornia.enhance.adjust_contrast`
- Examples:
+ Examples:
>>> rng = torch.manual_seed(0)
>>> inputs = torch.rand(1, 3, 3, 3)
- >>> aug = RandomContrast(contrast = (0.5,2.),p=1.)
+ >>> aug = RandomContrast(contrast = (0.5, 2.), p = 1.)
>>> aug(inputs)
tensor([[[[0.2750, 0.4258, 0.0490],
[0.0732, 0.1704, 0.3514],
@@ -47,6 +47,7 @@ class RandomContrast(IntensityAugmentationBase2D):
[0.2325, 0.3064, 0.5281]]]])
To apply the exact augmenation again, you may take the advantage of the previous parameter state:
+
>>> input = torch.rand(1, 3, 32, 32)
>>> aug = RandomContrast((0.8,1.2), p=1.)
>>> (aug(input) == aug(input, params=aug._params)).all()
diff --git a/kornia/augmentation/_2d/intensity/hue.py b/kornia/augmentation/_2d/intensity/hue.py
index 50b96d4d1..8852374f1 100644
--- a/kornia/augmentation/_2d/intensity/hue.py
+++ b/kornia/augmentation/_2d/intensity/hue.py
@@ -27,9 +27,9 @@ class RandomHue(IntensityAugmentationBase2D):
- Output: :math:`(B, C, H, W)`
.. note::
- This function internally uses :func:`kornia.enhance.adjust_hue
+ This function internally uses :func:`kornia.enhance.adjust_hue`
- Examples:
+ Examples:
>>> rng = torch.manual_seed(0)
>>> inputs = torch.rand(1, 3, 3, 3)
>>> aug = RandomHue(hue = (-0.5,0.5),p=1.)
@@ -47,6 +47,7 @@ class RandomHue(IntensityAugmentationBase2D):
[0.5185, 0.8964, 0.4556]]]])
To apply the exact augmenation again, you may take the advantage of the previous parameter state:
+
>>> input = torch.rand(1, 3, 32, 32)
>>> aug = RandomHue((-0.2,0.2), p=1.)
>>> (aug(input) == aug(input, params=aug._params)).all()
diff --git a/kornia/augmentation/_2d/intensity/saturation.py b/kornia/augmentation/_2d/intensity/saturation.py
index 59a45ef3b..7513a763c 100644
--- a/kornia/augmentation/_2d/intensity/saturation.py
+++ b/kornia/augmentation/_2d/intensity/saturation.py
@@ -26,9 +26,9 @@ class RandomSaturation(IntensityAugmentationBase2D):
- Output: :math:`(B, C, H, W)`
.. note::
- This function internally uses :func:`kornia.enhance.adjust_saturation
+ This function internally uses :func:`kornia.enhance.adjust_saturation`
- Examples:
+ Examples:
>>> rng = torch.manual_seed(0)
>>> inputs = torch.rand(1, 3, 3, 3)
>>> aug = RandomSaturation(saturation = (0.5,2.),p=1.)
@@ -46,6 +46,7 @@ class RandomSaturation(IntensityAugmentationBase2D):
[0.4636, 0.7060, 0.9527]]]])
To apply the exact augmenation again, you may take the advantage of the previous parameter state:
+
>>> input = torch.rand(1, 3, 32, 32)
>>> aug = RandomSaturation((0.8,1.2), p=1.)
>>> (aug(input) == aug(input, params=aug._params)).all()
diff --git a/kornia/augmentation/_2d/mix/cutmix.py b/kornia/augmentation/_2d/mix/cutmix.py
index 9fe147f0a..b8ce79ee8 100644
--- a/kornia/augmentation/_2d/mix/cutmix.py
+++ b/kornia/augmentation/_2d/mix/cutmix.py
@@ -10,7 +10,7 @@ from kornia.geometry.bbox import bbox_to_mask, infer_bbox_shape
class RandomCutMixV2(MixAugmentationBaseV2):
r"""Apply CutMix augmentation to a batch of tensor images.
- .. image:: _static/img/RandomCutMix.png
+ .. image:: _static/img/RandomCutMixV2.png
Implementation for `CutMix: Regularization Strategy to Train Strong Classifiers with
Localizable Features` :cite:`yun2019cutmix`.
diff --git a/kornia/augmentation/_2d/mix/mixup.py b/kornia/augmentation/_2d/mix/mixup.py
index e1bd21fdd..e8df4c851 100644
--- a/kornia/augmentation/_2d/mix/mixup.py
+++ b/kornia/augmentation/_2d/mix/mixup.py
@@ -9,7 +9,7 @@ from kornia.core import Tensor, stack, zeros
class RandomMixUpV2(MixAugmentationBaseV2):
r"""Apply MixUp augmentation to a batch of tensor images.
- .. image:: _static/img/RandomMixUp.png
+ .. image:: _static/img/RandomMixUpV2.png
Implementation for `mixup: BEYOND EMPIRICAL RISK MINIMIZATION` :cite:`zhang2018mixup`.
diff --git a/kornia/augmentation/container/dispatcher.py b/kornia/augmentation/container/dispatcher.py
index 0cc70ebf8..ca7a1e8a4 100644
--- a/kornia/augmentation/container/dispatcher.py
+++ b/kornia/augmentation/container/dispatcher.py
@@ -7,10 +7,10 @@ from kornia.augmentation.container.augment import AugmentationSequential
class ManyToManyAugmentationDispather(nn.Module):
- """Dispatches different augmentations to different inputs element-wisely.
+ r"""Dispatches different augmentations to different inputs element-wisely.
Args:
- augmentations: *args: a list of kornia AugmentationSequential modules.
+ augmentations: a list or a sequence of kornia AugmentationSequential modules.
Examples:
>>> import torch
@@ -47,20 +47,20 @@ class ManyToManyAugmentationDispather(nn.Module):
class ManyToOneAugmentationDispather(nn.Module):
- """Dispatches different augmentations to a single input and returns a list.
+ r"""Dispatches different augmentations to a single input and returns a list.
Same `datakeys` must be applied across different augmentations. By default, with input
(image, mask), the augmentations must not mess it as (mask, image) to avoid unexpected
errors. This check can be cancelled with `strict=False` if needed.
Args:
- augmentations: *args: a list of kornia AugmentationSequential modules.
+ augmentations: a list or a sequence of kornia AugmentationSequential modules.
Examples:
>>> import torch
>>> input = torch.randn(2, 3, 5, 6)
>>> mask = torch.ones(2, 3, 5, 6)
- >>> aug_list = ManyToManyAugmentationDispather(
+ >>> aug_list = ManyToOneAugmentationDispather(
... AugmentationSequential(
... kornia.augmentation.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=1.0),
... kornia.augmentation.RandomAffine(360, p=1.0),
@@ -72,7 +72,7 @@ class ManyToOneAugmentationDispather(nn.Module):
... data_keys=["input", "mask",],
... )
... )
- >>> output = aug_list((input, mask))
+ >>> output = aug_list(input, mask)
"""
def __init__(self, *augmentations: AugmentationSequential, strict: bool = True) -> None:
diff --git a/kornia/enhance/adjust.py b/kornia/enhance/adjust.py
index 5c5539177..44886ba97 100644
--- a/kornia/enhance/adjust.py
+++ b/kornia/enhance/adjust.py
@@ -542,8 +542,8 @@ def adjust_sigmoid(image: Tensor, cutoff: float = 0.5, gain: float = 10, inv: bo
The input image is expected to be in the range of [0, 1].
Reference:
- [1]: Gustav J. Braun, "Image Lightness Rescaling Using Sigmoidal Contrast Enhancement Functions",
- http://markfairchild.org/PDFs/PAP07.pdf
+ [1]: Gustav J. Braun, "Image Lightness Rescaling Using Sigmoidal Contrast Enhancement Functions",
+ http://markfairchild.org/PDFs/PAP07.pdf
Args:
image: Image to be adjusted in the shape of :math:`(*, H, W)`.
@@ -1304,8 +1304,8 @@ class AdjustSigmoid(Module):
The input image is expected to be in the range of [0, 1].
Reference:
- [1]: Gustav J. Braun, "Image Lightness Rescaling Using Sigmoidal Contrast Enhancement Functions",
- http://markfairchild.org/PDFs/PAP07.pdf
+ [1]: Gustav J. Braun, "Image Lightness Rescaling Using Sigmoidal Contrast Enhancement Functions",
+ http://markfairchild.org/PDFs/PAP07.pdf
Args:
image: Image to be adjusted in the shape of :math:`(*, H, W)`.
diff --git a/kornia/geometry/boxes.py b/kornia/geometry/boxes.py
index a7d1bd866..a8162c223 100644
--- a/kornia/geometry/boxes.py
+++ b/kornia/geometry/boxes.py
@@ -170,15 +170,16 @@ class Boxes:
Args:
boxes: 2D boxes, shape of :math:`(N, 4, 2)`, :math:`(B, N, 4, 2)` or a list of :math:`(N, 4, 2)`.
See below for more details.
- raise_if_not_floating_point: flag to control floating point casting behaviour when `boxes` is not a floating
- point tensor. True to raise an error when `boxes` isn't a floating point tensor, False to cast to float.
+ raise_if_not_floating_point: flag to control floating point casting behaviour when `boxes` is not a
+ floating point tensor. True to raise an error when `boxes` isn't a floating point tensor, False
+ to cast to float.
mode: the box format of the input boxes.
Note:
**2D boxes format** is defined as a floating data type tensor of shape ``Nx4x2`` or ``BxNx4x2``
- where each box is a `quadrilateral <https://en.wikipedia.org/wiki/Quadrilateral>`_ defined by it's 4 vertices
- coordinates (A, B, C, D). Coordinates must be in ``x, y`` order. The height and width of a box is defined as
- ``width = xmax - xmin + 1`` and ``height = ymax - ymin + 1``. Examples of
+ where each box is a `quadrilateral <https://en.wikipedia.org/wiki/Quadrilateral>`_ defined by it's
+ 4 vertices coordinates (A, B, C, D). Coordinates must be in ``x, y`` order. The height and width of
+ a box is defined as ``width = xmax - xmin + 1`` and ``height = ymax - ymin + 1``. Examples of
`quadrilaterals <https://en.wikipedia.org/wiki/Quadrilateral>`_ are rectangles, rhombus and trapezoids.
"""
@@ -281,20 +282,28 @@ class Boxes:
"""Trim out zero padded boxes.
Given box arrangements of shape :math:`(4, 4, Box)`:
- -- Box -- Box -- Box -- Box --
- -- 0 -- 0 -- Box -- Box --
- -- 0 -- Box -- 0 -- 0 --
- -- 0 -- 0 -- 0 -- 0 --
-
- Nothing will change if correspondence_preserve is True. Only pure zero layers will be
- removed, resulting in shape :math:`(4, 3, Box)`:
- -- Box -- Box -- Box -- Box --
- -- 0 -- 0 -- Box -- Box --
- -- 0 -- Box -- 0 -- 0 --
+ == === == === == === == === ==
+ -- Box -- Box -- Box -- Box --
+ -- 0 -- 0 -- Box -- Box --
+ -- 0 -- Box -- 0 -- 0 --
+ -- 0 -- 0 -- 0 -- 0 --
+ == === == === == === == === ==
+
+ Nothing will change if correspondence_preserve is True. Only pure zero layers will be removed, resulting in
+ shape :math:`(4, 3, Box)`:
+
+ == === == === == === == === ==
+ -- Box -- Box -- Box -- Box --
+ -- 0 -- 0 -- Box -- Box --
+ -- 0 -- Box -- 0 -- 0 --
+ == === == === == === == === ==
Otherwise, you will get :math:`(4, 2, Box)`:
- -- Box -- Box -- Box -- Box --
- -- 0 -- Box -- Box -- Box --
+
+ == === == === == === == === ==
+ -- Box -- Box -- Box -- Box --
+ -- 0 -- Box -- Box -- Box --
+ == === == === == === == === ==
"""
raise NotImplementedError
diff --git a/kornia/geometry/conversions.py b/kornia/geometry/conversions.py
index e70e3d469..0e584d4b3 100644
--- a/kornia/geometry/conversions.py
+++ b/kornia/geometry/conversions.py
@@ -1243,13 +1243,12 @@ def normalize_homography3d(
def normalize_points_with_intrinsics(point_2d: Tensor, camera_matrix: Tensor):
- r"""Normalizes points with intrinsics. Useful for conversion of keypoints to be used with essential matrix.
+ """Normalizes points with intrinsics. Useful for conversion of keypoints to be used with essential matrix.
Args:
- point_2d: tensor containing the 2d points in the image pixel coordinates.
- The shape of the tensor can be :math:`(*, 2)`.
- camera_matrix: tensor containing the intrinsics camera
- matrix. The tensor shape must be :math:`(*, 3, 3)`.
+ point_2d: tensor containing the 2d points in the image pixel coordinates. The shape of the tensor can be
+ :math:`(*, 2)`.
+ camera_matrix: tensor containing the intrinsics camera matrix. The tensor shape must be :math:`(*, 3, 3)`.
Returns:
tensor of (u, v) cam coordinates with shape :math:`(*, 2)`.
@@ -1286,13 +1285,12 @@ def normalize_points_with_intrinsics(point_2d: Tensor, camera_matrix: Tensor):
def denormalize_points_with_intrinsics(point_2d_norm: Tensor, camera_matrix: Tensor):
- r"""Normalizes points with intrinsics. Useful for conversion of keypoints to be used with essential matrix.
+ """Normalizes points with intrinsics. Useful for conversion of keypoints to be used with essential matrix.
Args:
- point_2d_norm: tensor containing the 2d points in the image pixel coordinates.
- The shape of the tensor can be :math:`(*, 2)`.
- camera_matrix: tensor containing the intrinsics camera
- matrix. The tensor shape must be :math:`(*, 3, 3)`.
+ point_2d_norm: tensor containing the 2d points in the image pixel coordinates. The shape of the tensor can be
+ :math:`(*, 2)`.
+ camera_matrix: tensor containing the intrinsics camera matrix. The tensor shape must be :math:`(*, 3, 3)`.
Returns:
tensor of (u, v) cam coordinates with shape :math:`(*, 2)`.
diff --git a/kornia/geometry/epipolar/_metrics.py b/kornia/geometry/epipolar/_metrics.py
index e90999178..a2fa3cd15 100644
--- a/kornia/geometry/epipolar/_metrics.py
+++ b/kornia/geometry/epipolar/_metrics.py
@@ -10,15 +10,14 @@ from kornia.testing import KORNIA_CHECK_IS_TENSOR
def sampson_epipolar_distance(
pts1: Tensor, pts2: Tensor, Fm: Tensor, squared: bool = True, eps: float = 1e-8
) -> Tensor:
- r"""Return Sampson distance for correspondences given the fundamental matrix.
+ """Return Sampson distance for correspondences given the fundamental matrix.
Args:
- pts1: correspondences from the left images with shape
- (*, N, 2 or 3). If they are not homogeneous, converted automatically.
- pts2: correspondences from the right images with shape
- (*, N, 2 or 3). If they are not homogeneous, converted automatically.
- Fm: Fundamental matrices with shape :math:`(*, 3, 3)`. Called Fm to
- avoid ambiguity with torch.nn.functional.
+ pts1: correspondences from the left images with shape :math:`(*, N, (2|3))`. If they are not homogeneous,
+ converted automatically.
+ pts2: correspondences from the right images with shape :math:`(*, N, (2|3))`. If they are not homogeneous,
+ converted automatically.
+ Fm: Fundamental matrices with shape :math:`(*, 3, 3)`. Called Fm to avoid ambiguity with torch.nn.functional.
squared: if True (default), the squared distance is returned.
eps: Small constant for safe sqrt.
@@ -62,15 +61,14 @@ def sampson_epipolar_distance(
def symmetrical_epipolar_distance(
pts1: Tensor, pts2: Tensor, Fm: Tensor, squared: bool = True, eps: float = 1e-8
) -> Tensor:
- r"""Return symmetrical epipolar distance for correspondences given the fundamental matrix.
+ """Return symmetrical epipolar distance for correspondences given the fundamental matrix.
Args:
- pts1: correspondences from the left images with shape
- (*, N, 2 or 3). If they are not homogeneous, converted automatically.
- pts2: correspondences from the right images with shape
- (*, N, 2 or 3). If they are not homogeneous, converted automatically.
- Fm: Fundamental matrices with shape :math:`(*, 3, 3)`. Called Fm to
- avoid ambiguity with torch.nn.functional.
+ pts1: correspondences from the left images with shape :math:`(*, N, (2|3))`. If they are not homogeneous,
+ converted automatically.
+ pts2: correspondences from the right images with shape :math:`(*, N, (2|3))`. If they are not homogeneous,
+ converted automatically.
+ Fm: Fundamental matrices with shape :math:`(*, 3, 3)`. Called Fm to avoid ambiguity with torch.nn.functional.
squared: if True (default), the squared distance is returned.
eps: Small constant for safe sqrt.
diff --git a/kornia/geometry/epipolar/fundamental.py b/kornia/geometry/epipolar/fundamental.py
index 35f69ab2f..67e2e0dee 100644
--- a/kornia/geometry/epipolar/fundamental.py
+++ b/kornia/geometry/epipolar/fundamental.py
@@ -187,15 +187,14 @@ def get_perpendicular(lines: Tensor, points: Tensor) -> Tensor:
def get_closest_point_on_epipolar_line(pts1: Tensor, pts2: Tensor, Fm: Tensor) -> Tensor:
- r"""Return closest point on the epipolar line to the correspondence, given the fundamental matrix.
+ """Return closest point on the epipolar line to the correspondence, given the fundamental matrix.
Args:
- pts1: correspondences from the left images with shape
- (*, N, 2 or 3). If they are not homogeneous, converted automatically.
- pts2: correspondences from the right images with shape
- (*, N, 2 or 3). If they are not homogeneous, converted automatically.
- Fm: Fundamental matrices with shape :math:`(*, 3, 3)`. Called Fm to
- avoid ambiguity with torch.nn.functional.
+ pts1: correspondences from the left images with shape :math:`(*, N, (2|3))`. If they are not homogeneous,
+ converted automatically.
+ pts2: correspondences from the right images with shape :math:`(*, N, (2|3))`. If they are not homogeneous,
+ converted automatically.
+ Fm: Fundamental matrices with shape :math:`(*, 3, 3)`. Called Fm to avoid ambiguity with torch.nn.functional.
Returns:
point on epipolar line :math:`(*, N, 2)`.
diff --git a/kornia/geometry/homography.py b/kornia/geometry/homography.py
index 988ca6d3e..f8de186ce 100644
--- a/kornia/geometry/homography.py
+++ b/kornia/geometry/homography.py
@@ -245,14 +245,17 @@ def sample_is_valid_for_homography(points1: Tensor, points2: Tensor) -> Tensor:
def find_homography_lines_dlt(ls1: Tensor, ls2: Tensor, weights: Optional[Tensor] = None) -> Tensor:
- r"""Compute the homography matrix using the DLT formulation for line correspondences.
+ """Compute the homography matrix using the DLT formulation for line correspondences.
See :cite:`homolines2001` for details.
+
The linear system is solved by using the Weighted Least Squares Solution for the 4 Line correspondences algorithm.
+
Args:
ls1: A set of line segments in the first image with a tensor shape :math:`(B, N, 2, 2)`.
ls2: A set of line segments in the second image with a tensor shape :math:`(B, N, 2, 2)`.
weights: Tensor containing the weights per point correspondence with a shape of :math:`(B, N)`.
+
Returns:
the computed homography matrix with shape :math:`(B, 3, 3)`.
"""
diff --git a/kornia/geometry/linalg.py b/kornia/geometry/linalg.py
index 640d7a7c3..323309813 100644
--- a/kornia/geometry/linalg.py
+++ b/kornia/geometry/linalg.py
@@ -242,6 +242,7 @@ def euclidean_distance(x: Tensor, y: Tensor, keepdim: bool = False, eps: float =
"""Compute the Euclidean distance between two set of n-dimensional points.
More: https://en.wikipedia.org/wiki/Euclidean_distance
+
Args:
x: first set of points of shape :math:`(*, N)`.
y: second set of points of shape :math:`(*, N)`.