Transform Point with Perspective Transform Matrix

Averius picture Averius · Sep 3, 2012 · Viewed 10.4k times · Source

I have the coordinates of a quadrilateral which was photographed out of two different perspectives. Furthermore I have the coordinates of one Point but only from one of the two perspectives. I need to transform the coordinates of this point to the perspective the second photograph of the rectangle was made. Do do this I use OpenCV

I've calculated the Perspective Transform Matrix:

cv::getPerspectiveTransform(quad1, quad2);

My Problem now is that I don't really know how to transform the Point with the calculated Perspective Transform Matrix. This is probably quite simple but I just don't know how to do it.

Answer

Ben picture Ben · Sep 3, 2012

I recommend the new OpenCV forum for OpenCV-related questions, where I answered a very similar question with a little sample code.

But basically, it's using the

void perspectiveTransform(vector<Point2f> origPoints, vector<Point2f> transformedPoints, Mat h)

function.