Ask Your Question

GetPerspectiveTransform mathematical explanation

Hi guys! I'm doing a course project devoted to perspective transformations. I have a ready opencv function GetPerspectiveTransform that takes my source array CvPoint2D32f srcQuad[4] and gets destination array CvPoint2D32f dstQuad[4] using a matrix of perspective transformation CvMat* warp_matrix = cvCreateMat(3,3,CV_32FC1); But is there a mathematical analogue of this function? I mean can I using some mathematical formulas replace ready function GetPerspectiveTransform? Thank you very much for any assistance.

edit retag close merge delete

1 answer

Sort by ยป oldest newest most voted

The function GetPerspectiveTransform calculates the matrix of perspective transformation between srcQuad points and dstQuad points. In other words it calculates coefficients of perspective transformation which maps (xi,yi) to (ui,vi), (i=1,2,3,4):

      c00*xi + c01*yi + c02
ui = ---------------------
c20*xi + c21*yi + c22

c10*xi + c11*yi + c12
vi = ---------------------
c20*xi + c21*yi + c22


Coefficients are calculated by solving linear system:

  / x0 y0  1  0  0  0 -x0*u0 -y0*u0 \ /c00\    /u0\
| x1 y1  1  0  0  0 -x1*u1 -y1*u1 | |c01|    |u1|
| x2 y2  1  0  0  0 -x2*u2 -y2*u2 | |c02|    |u2|
| x3 y3  1  0  0  0 -x3*u3 -y3*u3 |.|c10| =  |u3|
|  0  0  0 x0 y0  1 -x0*v0 -y0*v0 | |c11|    |v0|
|  0  0  0 x1 y1  1 -x1*v1 -y1*v1 | |c12|    |v1|
|  0  0  0 x2 y2  1 -x2*v2 -y2*v2 | |c20|    |v2|
\  0  0  0 x3 y3  1 -x3*v3 -y3*v3 / \c21/    \v3/


where: cij - matrix coefficients, c22 = 1

more

Comments

Hey, do you know any paper where it is explained more specific?

( 2012-12-12 06:31:57 -0500 )edit

Sorry, but I don't know such paper.

( 2012-12-12 09:15:54 -0500 )edit

Stats

Asked: 2012-12-09 03:07:20 -0500

Seen: 1,985 times

Last updated: Dec 11 '12