Ask Your Question

Some trouble with Perspective Transform

asked 2013-03-09 01:39:17 -0600

Andreyk6 gravatar image

updated 2013-03-09 10:15:35 -0600

Hello, i use PerspectiveTransform and as a result have matrix of transformation. I need transform coordinates of ONE point using this matrix, i read that i can use coficient of matrix for calculate it, and matrix buil like this image description

x'i = (Ax + By + C)/(ax+ by + c)

y'i = (Dx + Ey + F)/(ax+ by + c)

CvPoint2D32f srcQuad[4], dstQuad[4];
CvMat* warp_matrix = cvCreateMat(3,3,CV_32FC1);
srcQuad... some code here
dstQuad... and here

But when i use this formula it don`t work corectly every time


I think that the transformation matrix in OpenCV has a different structure, or I made ​​a mistake somewhere. Perhaps there is other variant coordinate transformation one point? And Sorry for my english)

edit retag flag offensive close merge delete


have you compared your result with the output of cv::transform(...) ?

Guanta gravatar imageGuanta ( 2013-03-09 05:40:51 -0600 )edit

1 answer

Sort by » oldest newest most voted

answered 2013-03-09 07:40:14 -0600

Daniil Osokin gravatar image

Hi! You should transpose your matrix on image to get the formula below it. OpenCV uses this formula: image description
where (Mij) - transformation matrix. About perspective transformation in OpenCV you can read here.

edit flag offensive delete link more



Thank you.

Andreyk6 gravatar imageAndreyk6 ( 2013-03-09 10:34:32 -0600 )edit

Question Tools


Asked: 2013-03-09 01:39:17 -0600

Seen: 801 times

Last updated: Mar 09 '13