我需要做一个简单的任务:有一个引用图像,计算另一个图像的像素平移考虑到没有没有缩放和没有旋转,只是平移:(x, y)。有了这个,哪个是easies方法?自相关?特征提取?我猜根本不需要特征提取,因为这是一项简单的任务。
任何帮助将不胜感激, 干杯,
最佳答案
最后我找到了实现我目标的解决方案:
// Prepare required variables
cv::Point point;
cv::Mat correlation;
double max_val;
// Compute the template matching
cv::matchTemplate(image_crop, ref_crop, correlation, cv::TM_CCORR_NORMED);
// Find the position of the max point
cv::minMaxLoc(correlation, NULL, &max_val, NULL, &point);
其中点变量包含平移坐标 x 和 y。
关于c++ - 使用 OpenCV 检测图像转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14828076/