kornia.geometry.warp

class HomographyWarper(height: int, width: int, mode: str = 'bilinear', padding_mode: str = 'zeros', normalized_coordinates: bool = True, align_corners: bool = False)[source]

Warp tensors by homographies.

\[X_{dst} = H_{src}^{\{dst\}} * X_{src}\]
Parameters
  • height (int) – The height of the destination tensor.

  • width (int) – The width of the destination tensor.

  • mode (str) – interpolation mode to calculate output values ‘bilinear’ | ‘nearest’. Default: ‘bilinear’.

  • padding_mode (str) – padding mode for outside grid values ‘zeros’ | ‘border’ | ‘reflection’. Default: ‘zeros’.

  • normalized_coordinates (bool) – wether to use a grid with normalized coordinates.

  • align_corners (bool) – interpolation flag. Default: False. See

  • https – //pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.interpolate for detail

class DepthWarper(pinhole_dst: kornia.geometry.camera.pinhole.PinholeCamera, height: int, width: int, mode: str = 'bilinear', padding_mode: str = 'zeros', align_corners: bool = True)[source]

Warps a patch by depth.

\[ \begin{align}\begin{aligned}P_{src}^{\{dst\}} = K_{dst} * T_{src}^{\{dst\}}\\\begin{split}I_{src} = \\omega(I_{dst}, P_{src}^{\{dst\}}, D_{src})\end{split}\end{aligned}\end{align} \]
Parameters
  • pinholes_dst (PinholeCamera) – the pinhole models for the destination frame.

  • height (int) – the height of the image to warp.

  • width (int) – the width of the image to warp.

  • mode (str) – interpolation mode to calculate output values ‘bilinear’ | ‘nearest’. Default: ‘bilinear’.

  • padding_mode (str) – padding mode for outside grid values ‘zeros’ | ‘border’ | ‘reflection’. Default: ‘zeros’.

  • align_corners (bool) – interpolation flag. Default: True. See https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.interpolate for detail

homography_warp(patch_src: torch.Tensor, src_homo_dst: torch.Tensor, dsize: Tuple[int, int], mode: str = 'bilinear', padding_mode: str = 'zeros', align_corners: bool = False, normalized_coordinates: bool = True) → torch.Tensor[source]
depth_warp(pinhole_dst: kornia.geometry.camera.pinhole.PinholeCamera, pinhole_src: kornia.geometry.camera.pinhole.PinholeCamera, depth_src: torch.Tensor, patch_dst: torch.Tensor, height: int, width: int, align_corners: bool = True)[source]
warp_grid(grid: torch.Tensor, src_homo_dst: torch.Tensor) → torch.Tensor[source]
normalize_homography(dst_pix_trans_src_pix: torch.Tensor, dsize_src: Tuple[int, int], dsize_dst: Tuple[int, int]) → torch.Tensor[source]
normal_transform_pixel(height: int, width: int, eps: float = 1e-14, device: Optional[torch.device] = None, dtype: Optional[torch.dtype] = None) → torch.Tensor[source]
normal_transform_pixel3d(depth: int, height: int, width: int, eps: float = 1e-14, device: Optional[torch.device] = None, dtype: Optional[torch.dtype] = None) → torch.Tensor[source]