Ask Your Question
2

GetPerspectiveTransform mathematical explanation

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

lindstorm gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
5

answered 2012-12-09 05:24:52 -0500

AlexanderShishkov gravatar image

updated 2012-12-11 10:36:46 -0500

SR gravatar image

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

edit flag offensive delete link more

Comments

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

Bomber19 gravatar imageBomber19 ( 2012-12-12 06:31:57 -0500 )edit

Sorry, but I don't know such paper.

AlexanderShishkov gravatar imageAlexanderShishkov ( 2012-12-12 09:15:54 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 2,002 times

Last updated: Dec 11 '12