# kornia.geometry.homography¶

Module with useful functionalities for homographies manipulation.

find_homography_dlt(points1: torch.Tensor, points2: torch.Tensor, weights: torch.Tensor) → torch.Tensor[source]

Computes the homography matrix using the DLT formulation.

The linear system is solved by using the Weighted Least Squares Solution for the 4 Points algorithm.

Parameters
• points1 (torch.Tensor) – A set of points in the first image with a tensor shape $$(B, N, 2)$$.

• points2 (torch.Tensor) – A set of points in the second image with a tensor shape $$(B, N, 2)$$.

• weights (torch.Tensor) – Tensor containing the weights per point correspondence with a shape of $$(B, N)$$.

Returns

the computed homography matrix with shape $$(B, 3, 3)$$.

Return type

torch.Tensor

find_homography_dlt_iterated(points1: torch.Tensor, points2: torch.Tensor, weights: torch.Tensor, soft_inl_th: float = 3.0, n_iter: int = 5) → torch.Tensor[source]

Computes the homography matrix using the iteratively-reweighted least squares (IRWLS).

The linear system is solved by using the Reweighted Least Squares Solution for the 4 Points algorithm.

Parameters
• points1 (torch.Tensor) – A set of points in the first image with a tensor shape $$(B, N, 2)$$.

• points2 (torch.Tensor) – A set of points in the second image with a tensor shape $$(B, N, 2)$$.

• weights (torch.Tensor) – Tensor containing the weights per point correspondence with a shape of $$(B, N)$$. Used for the first iteration of the IRWLS.

• soft_inl_th (float) – Soft inlier threshold used for weight calculation.

• n_iter (int) – number of iterations. Default is 5.

Returns

the computed homography matrix with shape $$(B, 3, 3)$$.

Return type

torch.Tensor