1
votes

I want to display a model on image using Camera extrinsic matrix and gluLookAt function.

The model is translated to origin, that is, the model's center of mass is at origin. (model's coordinates is based on right-hand)

And using cvFindExtrinsicCameraParams2 function, i got camera extrinsic matrix E = [R|t].

For this case, i'd like to display cad model using gluLookat.

It has three parameters ; camera position, camera eye, camera up.

What values that i have to enter?

I guess, camera position is t : extrinsic matrix's translation values.

Also, if rotation and translation are zero, then camera see model through (0,0,1) vector. Thus, if rotation exists, camera eye should be R*(0,1,0).

Finally camera up, it should be (0,-1,0) at first if camera looks model at the front. Then new camera up vector is R * (0,-1,0).

But it does not give me a correct result. What's the problem? What's my mistake?

1

1 Answers

0
votes

The eye is a point in space at which the camera is looking. What you currently calculate is the direction in which it should look. You can, for example, use

eye = t + R * [0,0,1];

I'm wondering why you try to recreate the camera matrix using glLookAt, since the result should be exactly the extrinsic camera matrix that you already have.