π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
ImageStitcher accepts classical local feature matcher (#1416)
Dmytro Mishkin5df4d188629d
diff --git a/kornia/contrib/image_stitching.py b/kornia/contrib/image_stitching.pyindex d2ba28370..f6862285c 100644--- a/kornia/contrib/image_stitching.py+++ b/kornia/contrib/image_stitching.py@@ -4,7 +4,7 @@ import torchimport torch.nn as nnfrom kornia.color import rgb_to_grayscale-from kornia.feature import LoFTR+from kornia.feature import LocalFeatureMatcher, LoFTRfrom kornia.geometry.homography import find_homography_dlt_iteratedfrom kornia.geometry.ransac import RANSACfrom kornia.geometry.transform import warp_perspective@@ -88,7 +88,7 @@ class ImageStitcher(nn.Module):def preprocess(self, image_1: torch.Tensor, image_2: torch.Tensor) -> Dict[str, torch.Tensor]:"""Preprocess input to the required format."""# TODO: probably perform histogram matching here.- if isinstance(self.matcher, LoFTR):+ if isinstance(self.matcher, LoFTR) or isinstance(self.matcher, LocalFeatureMatcher):input_dict: Dict[str, torch.Tensor] = { # LofTR works on grayscale images only"image0": rgb_to_grayscale(image_1),"image1": rgb_to_grayscale(image_2)