有人可以帮我,我们如何计算转换图像中关键点的新位置,关键点是在原始图像中检测到的。我正在使用 opencv 单应矩阵和 warpPerspective 来制作转换后的图像。
这是一个代码..
...
std::vector< Point2f > points1,points2;
for( int i = 0; i < matches1.size(); i++ )
{
points1.push_back( keypoints_input1[matches1[i].queryIdx ].pt );
points2.push_back( keypoints_input2[matches1[i].trainIdx ].pt );
}
/* Find the Homography Matrix for current and next frame*/
Mat H1 = findHomography( points2, points1, CV_RANSAC );
/* Use the Homography Matrix to warp the images*/
cv::Mat result1;
warpPerspective(input2, result1, H1, Size(input2.cols+150, input2.rows+150),
INTER_CUBIC);
...
}
现在我想计算结果 1 图像中点 2 的新位置。
例如在下面的转换图像中,我们知道角点。现在我想计算转换前关键点的新位置 {(x1,y1),(x2,y2),(x3,y3)...},我们如何计算它?
更新:opencv 'perspectiveTransform' 做了我想做的事。