【问题标题】:How can I use Homography?如何使用 Homography?
【发布时间】:2012-11-04 19:14:48
【问题描述】:

我正在开发一个程序,我收到两张相同场景的图片,但其中一张有失真:

Mat img_1 = imread(argv[1], 0);  // nORMAL pICTURE
Mat img_2 = imread(argv[2], 0);  // PICTURE WITH DISTORTION

我想评估失真的模式并能够补偿它

我已经能够找到关键点,我想知道是否可以为此使用函数 cv::findHomography...无论如何,该怎么做?

【问题讨论】:

    标签: opencv distortion homography


    【解决方案1】:

    单应性会将一个图像平面映射到另一个图像平面。这意味着如果您的失真可以表示为 3x3 矩阵,那么 findHomography 就是您想要的。如果不是,那么这不是你想要的。它将对应点的两个向量作为输入,并返回最能代表这些点之间变换的 3x3 矩阵。

    【讨论】:

      【解决方案2】:

      好吧,假设我有两张图片(A 和 B),其中一张与另一张略有失真,它们之间存在平移、旋转和比例差异(例如,这些图片:)


      Ssoooooooo 我需要在图片 B 中应用一种转换,以补偿存在的失真/平移/旋转,以使两张图片具有相同的大小、方向且没有平移

      我已经提取了点并找到了 Homography,如下所示。但我不知道如何使用 Homography 来转换 Mat img_B 所以它看起来像 Mat img_A。有什么想法吗?

      //-- Localize the object from img_1 in img_2
      std::vector<Point2f> obj;
      std::vector<Point2f> scene;
      
      for (unsigned int i = 0; i < good_matches.size(); i++) {
          //-- Get the keypoints from the good matches
          obj.push_back(keypoints_object[good_matches[i].queryIdx].pt);
          scene.push_back(keypoints_scene[good_matches[i].trainIdx].pt);
      }
      
      Mat H = findHomography(obj, scene, CV_RANSAC);
      

      干杯,

      【讨论】:

      • 这似乎是一个问题。将其作为一个新问题提出,这不是一个答案。
      猜你喜欢
      • 1970-01-01
      • 2012-11-14
      • 1970-01-01
      • 2018-11-04
      • 2014-12-09
      • 2021-10-07
      • 1970-01-01
      • 2017-02-28
      • 1970-01-01
      相关资源
      最近更新 更多