PDA

View Full Version : Camera Problems!



Shweta
04-06-2005, 10:07 PM
Hi all!!
How does one find the focal length of the camera in GL? (it changes and depends on prespective i know!)
But how do i find out what it is?? esp given just PROJECTION and MODELVIEW matrix?
I need it to work out an Algorithm called POSIT :)

plasmonster
04-08-2005, 07:06 PM
There's really no focal length in the OpenGL camera model; it's a perfect pinhole (aperture = 0).

There are many examples of simulating lens effects, however. Try a search for "depth of field," for example.

I'm not entirely sure this is what you're after, but I hope it helps.

dorbie
04-10-2005, 02:30 AM
Don't confuse focal length with depth of field.

When this question is asked the poster is typically asking for the field of view as it correlates with some camera system (usually 35mm SLRs).

You can find this information online, but make sure it's the right information for the camera system you have in mind. Google threw this up, it seems like it's the kind of calculator you need:

http://www.dudak.baka.com/fovcalc.html

Note that you don't have to fully populate the boxes and for your purposes some fields are irrelevant. Keep the 35mm, type in the focal length and click calculate FOV and the end column will give you the degrees. Note that this is the diagonal angle, you could use a distance and take 2 * atan(long_side/focus_distance) to get the horizontal fov (use any value to seed the focus_distance) Of course short_side would give you vertical FOV (at least for a landscape orientation. ).

plasmonster
04-10-2005, 10:11 AM
Hey Dorbie,


When this question is asked the poster is typically asking for the field of view as it correlates with some camera system (usually 35mm SLRs).Yeah, I wasn't sure where to go with this after a brief scan of the POSIT algorithm (I haven't seen any questions in this area). So I thought I'd just throw something out there to get the ball rolling. Thanks for the suggestion.