perspective transformation with given camera pose

asked 2015-10-01 09:41:43 -0500

paws gravatar image

Hi everyone!

I'm trying to create a program, that I will use to perform some tests.

In this program an 2D image is being displayed in 3D space in the cv:viz window, so user can change camera (viewer) position and orientation.

image description

After that, program stores camera pose and takes the snaphot of the current view (without coordinates axes):

image description

An here is the goal:

I have the snaphot (perspective view of undetermined plane or part of the plane), camera pose (especially its orientation) and camera parameters. Using these given values I would like to perform perspective transformation to compute an ortographic view of this given image (or its visible part).

I can get the camera object and compute its projection matrix:

camera.computeProjectionMatrix(projectionMatrix);

and then decompose projection matrix:

decomposeProjectionMatrix(subProjMatrix,cameraMatrix, rotMatrix, transVect, rotMatX, rotMatY, rotMatZ);

And what should I do next? Notice, that I can't use chessboard cornersbecause the image is undetermined (it may be any image) and I can't use the corner points of the image, because user can zoom and translate the camera, so there is posibility, that no image corner point will be visible...

Thanks for any help in advance!

edit retag flag offensive close merge delete

Comments

First idea, after a quick search :

  • you have the intrinsic parameters
  • you have the camera pose associated to the snapshot
  • you should know the desired camera pose to have an orthographic view (e.g. no rotation, tz=1m away)
  • from this (p11), it seems that: x'=KR(K^-1)x=Hx with the known camera rotation R, but this seems to work only when there is no camera translation
  • also there is this link, but it seems that you have to know the normal vector and the distance to the plane.

You can first test with just a camera rotation if the formula H=KRK^-1 is working or not.

Eduardo gravatar imageEduardo ( 2015-10-01 12:34:24 -0500 )edit