Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

Perspective Transform using Chessboard

asked 2015-05-31 07:20:48 -0500

Phanta gravatar image

updated 2015-05-31 17:40:38 -0500


I need some help with this problem: I have a camera that takes a picture of something on a horizontal plane with a specific angle. That creates a perspective transform of this "something". And I would like to get this picture as if I would look down from top of it.

What I did already and one thing that I don't know how to do:

  1. I placed a chessboard there.
  2. I find the corners of the chessboard.
  3. ???
  4. cvGetPerspectiveTransform
  5. cvWarpPerspective

My problem is point 3. I have to find out Source and Destination Points which depend on the corners of the chessboard and the width of the picture that was taken, because they show the transformation. Source is easy: (0,0), (Width, 0), (0,Height) and (Width,Height), because I want the whole picture to be transformed. Destination however is difficult for me. I don't know how to find those points. I want that the whole picture (Not just the part with the chessboard inside) is transformed within a single step. Like in the picture below. I would appreciate any help.

Greetings and my thanks in advance, Phanta image description

edit retag flag offensive close merge delete


have a look in this sample here in order to see how to obtain the bird's eye view.

theodore gravatar imagetheodore ( 2015-05-31 10:27:16 -0500 )edit

No, that's not doing what I want. It just transforms the chessboard back to it's bird's eye view, but not the complete picture. I understood the basics that I need to do that and transforming a given part of a picture back to it's bird's-eye view is quite simple.

I just don't know how to calculate the 4 destination points to transform the whole picture back to it's bird's-eye view given a single chessboard that doesn't fill the complete picture

Phanta gravatar imagePhanta ( 2015-05-31 17:31:06 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-01 08:08:17 -0500

theodore gravatar image

updated 2015-06-01 08:18:18 -0500

actually what you are asking it cannot be done to the exact result that you wish. The reason for that is that you are lacking information, and here you can read a nice answer about it. Especially focus on this:

The aspect ratio of the destination rectangle can be chosen arbitrarily. In fact, it is not possible to deduce the "original aspect ratio" of the object in world coordinates, because "this is 2D homography, not 3D".

Thus, choosing arbitrarily destination points I managed for example to obtain the following results which I do not know how close are to your will.

image description image description

image description

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-05-31 07:20:48 -0500

Seen: 3,291 times

Last updated: Jun 01 '15