I need help in constructing Projection Matrix from Camera Calibration data.
I have rendered a scene after setting the perspective using gluPerspective() with some values after few trial and errors…and I am able to get a pretty decent rendering.
However I would like to get the ‘correct’ rendering using the camera calibration file data.
In that file, the Intrinsic Matrix [3x3] is given as:
I am no expert in camera calibration, but the GL_PROJECTION matrix in principle does the projection only and not the camera rotation you described, which is extrinsic and should be rather applied to the modelview matrix.
The intrinsic matrix is a 2d homgeous transformation, so I think it has not much to do with the projection (which is 3d homogenous), but rather with the viewport transformation (look for glViewport, glDepthRange). Setting the viewport will allow you to set the principal point ((564,428) in your case) and a scaling, I think. I am not sure about this, but you might want to try s.th. like
As for the skew 0.34 … i am not sure how to integrate this, but i am pretty sure it can’t be done in the viewport transform since it is not a freely definable matrix.
Maybe you should use a vertex shader to accomplish the task - this way you might also be able to do nonlinear lens undistort and so on if that is sth you want to do.