I am developping an 3D reconstruction application. So I am generating some
testing images using pov ray. To achieve the 3D reconstruction, I have to
calculate the matrix projection.
I am developping all necessary functions and I calculate the matrix project p=
K*[R,-R*C] where R is the rotation matrix and C is the camera center and K is
the internal matrix of the camera.
my camera setting is like this:
location<0, 0, 0>
translate<300, 250, -300>
direction <0, 0, 1>
look_at <0,0,1> }
The focal f=1, (norm[direction]), the angle =90 and the image is rendered as
600*800 pixels, so the matrix K=
(400 0 400.
0 -300 300.
0 0 1 ).
I calculate the rotation matrix like this:
To check if my Matrix P is true or not.
1) I photograph a cube using the camera above. I obtain its image 2D.
Therefore, I extract the coordinates of 3D corner of the cube and the
coordinate of its projection in the image 2D. for example corner 1= (100,0,-180)
its projection is (123,439).
2) I construct the same cube on matlab and I project it on 2D using the
projection matrix p and I get the coordinate 2D of the corners. I obtain the
if I cancel the rotation and the translation (R=matrix identity and C=(0,0,0))
the coordinate of corners are maching very well, so P is correct
If I translate the camera, The corner are matching very well, so P is correct.
If I make a translation and rotation, the corners does not match, so P is not
correct. So where is the error in my code and is the camera setting is correct
(I mean that I rotate the camera then I translate it or the inverse, regarding
the calculation of the matrix P=K*[R,-R*C]) ?
Is the calculation of the R is false or what????!! thanks to help me
Post a reply to this message