Fugitive

08-05-2009, 09:44 AM

Hi Guys,

I have Matlab code that renders (albiet very slowly) 3d points from the POV of a camera that is based on a real camera. The data originated from a stereo capture, and preserving the original camera's parameters is important. The camera model folows the opencv camera model:

http://opencv.willowgarage.com/documentation/_images/math/9072eb23f3db15124b9ff88d40f91621ac3da4bb.png

http://opencv.willowgarage.com/documentation/camera_calibration_and_3d_reconstruction.html

The only difference is that I dont multiply by s, and do a divide by z afterwards, which works just as well.

Now, I have all the parameters, cx, cy, fx, fy, and the Rotation/Translation matrix. However, Im not sure how to use these parameters in OpenGL. I've tried fiddling around with glFrustum and gluPerspective. I've even tried loading the perspective matrix (the one with fx and cx parameters) via glMultMatrixd and glLoadMatrixd but i keep getting a black screen.

In short, how do I convert this camera model into something that opengl expects?

BTW It works fine in Matlab, so the camera model is fine.

Thanks in advance.

Fugi

I have Matlab code that renders (albiet very slowly) 3d points from the POV of a camera that is based on a real camera. The data originated from a stereo capture, and preserving the original camera's parameters is important. The camera model folows the opencv camera model:

http://opencv.willowgarage.com/documentation/_images/math/9072eb23f3db15124b9ff88d40f91621ac3da4bb.png

http://opencv.willowgarage.com/documentation/camera_calibration_and_3d_reconstruction.html

The only difference is that I dont multiply by s, and do a divide by z afterwards, which works just as well.

Now, I have all the parameters, cx, cy, fx, fy, and the Rotation/Translation matrix. However, Im not sure how to use these parameters in OpenGL. I've tried fiddling around with glFrustum and gluPerspective. I've even tried loading the perspective matrix (the one with fx and cx parameters) via glMultMatrixd and glLoadMatrixd but i keep getting a black screen.

In short, how do I convert this camera model into something that opengl expects?

BTW It works fine in Matlab, so the camera model is fine.

Thanks in advance.

Fugi