我从一张名为 sourceImage 的图片中提取出了四个角:
src_vertices[0] = corners[upperLeft];
src_vertices[1] = corners[upperRight];
src_vertices[2] = corners[downLeft];
src_vertices[3] = corners[downRight];
这四个角被弯曲到destinationImage,就像这样:
dst_vertices[0] = Point(0,0);
dst_vertices[1] = Point(width, 0);
dst_vertices[2] = Point(0, height);
dst_vertices[3] = Point(width, height);
Mat warpPerspectiveMatrix = getPerspectiveTransform(src_vertices, dst_vertices);
cv::Size size_d = Size(width, height);
cv::Mat DestinationImage(width,height,CV_8UC3);
warpPerspective(sourceImage, destinationImage, warpPerspectiveMatrix, size_d, INTER_LINEAR, BORDER_CONSTANT);
现在我的问题是:
我有一个从destinationImage中取出的点p(x,y),如何在原始的sourceImage中检索该点的坐标?
换句话说,我想使用warpPerspectiveMatrix来执行与getPerspectiveTransform相反的工作。
warpPerspectiveMatrix
,然后将其应用于单个点,那么您将得到您想要的结果。这样做有什么问题吗? - mmgp