class_docstr: Stitch two images with overlapping fields of view.
  
  Args:
      matcher: image feature matching module.
      estimator: method to compute homography, either "vanilla" or "ransac".
          "ransac" is slower with a better accuracy.
      blending_method: method to blend two images together.
          Only "naive" is currently supported.
  
  Note:
      Current implementation requires strict image ordering from left to right.
  
  .. code-block:: python
  
      IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac').cuda()
      # Compute the stitched result with less GPU memory cost.
      with torch.inference_mode():
          out = IS(img_left, img_right)
      # Show the result
      plt.imshow(K.tensor_to_image(out))
class_docstr_tok: ["Stitch","two","images","with","overlapping","fields","of","view",".","Args",":","matcher",":","image","feature","matching","module",".","estimator",":","method","to","compute","homography",",","either","``","vanilla","''","or","``","ransac","''",".","``","ransac","''","is","slower","with","a","better","accuracy",".","blending_method",":","method","to","blend","two","images","together",".","Only","``","naive","''","is","currently","supported",".","Note",":","Current","implementation","requires","strict","image","ordering","from","left","to","right",".","..","code-block",":",":","python","IS","=","ImageStitcher","(","KF.LoFTR","(","pretrained='outdoor","'",")",",","estimator='ransac","'",")",".cuda","(",")","#","Compute","the","stitched","result","with","less","GPU","memory","cost",".","with","torch.inference_mode","(",")",":","out","=","IS","(","img_left",",","img_right",")","#","Show","the","result","plt.imshow","(","K.tensor_to_image","(","out",")",")"]
docstr: Estimate homography by the matched keypoints.
  
  Args:
      keypoints1: matched keypoint set from an image, shaped as :math:`(N, 2)`.
      keypoints2: matched keypoint set from the other image, shaped as :math:`(N, 2)`.
docstr_tok: ["Estimate","homography","by","the","matched","keypoints",".","Args",":","keypoints1",":","matched","keypoint","set","from","an","image",",","shaped","as",":","math",":","`","(","N",",","2",")","`",".","keypoints2",":","matched","keypoint","set","from","the","other","image",",","shaped","as",":","math",":","`","(","N",",","2",")","`","."]
code: def _estimate_homography(
      self, keypoints1: Tensor, keypoints2: Tensor
  ) -> Tensor:
      """Estimate homography by the matched keypoints.
  
      Args:
          keypoints1: matched keypoint set from an image, shaped as :math:`(N, 2)`.
          keypoints2: matched keypoint set from the other image, shaped as :math:`(N, 2)`.
      """
      if self.estimator == "vanilla":
          homo = find_homography_dlt_iterated(
              keypoints2[None],
              keypoints1[None],
              torch.ones_like(keypoints1[None, :, 0]),
          )
      elif self.estimator == "ransac":
          homo, _ = self.ransac(keypoints2, keypoints1)
          homo = homo[None]
      else:
          raise NotImplementedError(
              f"Unsupported estimator {self.estimator}. Use `ransac` or `vanilla` instead."
          )
      return homo
  
file_path: kornia/kornia/contrib/image_stitching.py
imports: from typing import Dict, Optional, Tuple
  import torch
  from kornia.color import rgb_to_grayscale
  from kornia.core import Module, Tensor, concatenate, where, zeros_like
  from kornia.feature import LocalFeatureMatcher, LoFTR
  from kornia.geometry.homography import find_homography_dlt_iterated
  from kornia.geometry.ransac import RANSAC
  from kornia.geometry.transform import warp_perspective
label_desc: Use image node_id 2 for calling the ImageStitcher obj's underlying member method code with example usage: obj._estimate_homography(keypoints1, keypoints2) and returns: homo