Yeah, I did some work on this issue about two weeks ago. I take OpenCV's
intrinsic camera parameters, fx, fy, cx and cy, image width, image height,
a near plane, and a far plane, and make a 4x4 OpenGL projection matrix out
of it. Here's the setup:
[ [ 2*fx/width, 0, (2*cx/width)-1, 0 ]
[ 0, 2*fy/height, (2*cy/height)-1, 0 ]
[ 0, 0, -(far+near)/(far-near), 0, -2*far*near/(far-near) ]
[ 0, 0, -1, 0 ] ]
The basic math I got from University of Cambridge Technical Report 634
(ucam-cl-tr-634), "Visualisation, interpretation and use of location-aware
interfaces", by Kasim Rehman, May 2005, but I had to correct a few small
errors. I've had good results using this matrix.
One thing, you should also make sure to use OpenCV's distortion
coefficients to do image unwarping first.
That covers the intrinsics, as for extrinsic parameters, translation and
rotation should easily be used for glTranslatef and glRotatef calls, but I
haven't done that explicitly myself, so I can't speak from experience.
-stephen diverdi
-sdiverdi@...
> Hi,
>
> I'm looking for some help on how to adapt the OpenCV camera
> parameters(Tsai model) to the OpenGl transformation matrices.
>
> I have my camera parameters (intrinsic, R and T matrices) using the
> camera calibration functions of OpenCV. Now I want to draw on top of
> the images using OpenGL. Herefor I need to plug in the Tsai
> parameters(R,T but also distortion and viewport) in the OpenGL
> transformation matrices.....
>
> Has anyone succeeded to do this? Any help would be very welcome...
>
> Thanks,
> Kenny
>
>
>
>
>
>
> Change settings:
http://www.yahoogroups.com/mygroups, select
> Get Emails (get all posts)
> Daily Digest (one summary email per day)
> Read on the web (read posts on the web only)Or Unsubscribe by mailing
OpenCV-unsubscribe@yahoogroups.com
>
> Yahoo! Groups Links
>
>
>
>
>
>