【发布时间】:2012-11-14 05:48:42
【问题描述】:
我有两张图片(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);
干杯,
【问题讨论】:
标签: opencv transformation distortion homography