Focal length for Perspective Camera

198 views
Skip to first unread message

Farhan Rahman wasee 1330237642

unread,
Oct 22, 2019, 10:43:58 PM10/22/19
to pbrt
Hi, so for my project I have created a few scenes using PBRT. I am using the Perspective camera with a FOV of 45 degrees. I wanted to know the focal length that is assigned for this camera. I could not find anything about this. I know you can do some math and use the half of image width/height and divide by the tan(half fov) to get the focal length in pixels but that does not seem to give a correct value. 

You might ask how do i know. So I am using the project point function in opencv which takes the camera intrinsics and extrinsics along with the 3D points and gives you the 2D coordinates. I verified the rotation and translations of the camera (The rotation being the rotation matrix and the translation being the location of the camera). I feel like something about my focal length is going horribly wrong. Can anyone help me in this regard? Any sort of help or pointers will be greatly appreciated! 

Thank you!

robert

unread,
Oct 27, 2019, 7:43:19 AM10/27/19
to pbrt
Hi

As of my understanding but anyone correct me if I'm wrong Perspective camera can not have focal length as it is only perspective transform with focus everywhere so it is ill formed to ask about something that isn't there. You should check realistic camera or something like this and i'm sure that problem of focus is covered in book

cheers
Robert

Daniel Thompson

unread,
Oct 27, 2019, 3:10:21 PM10/27/19
to pbrt
> Perspective camera can not have focal length as it is only perspective transform with focus everywhere

I think there is some confusion around terminology:

- Focal length is a measure of how strongly an optical system converges or diverges light. See https://en.wikipedia.org/wiki/Focal_length, but most especially the image here: https://en.wikipedia.org/wiki/File:Camera_focal_length_distance_house_animation.gif, where the focal length is in the bottom right, in meters. This is what OP is asking about.

- Focus distance is the distance from the camera origin to the plane of focus. This is what you're describing.

Thanks and regards,
Daniel

robert

unread,
Oct 31, 2019, 5:48:58 PM10/31/19
to pbrt
Hi

Thanks but I don't understand what you are saying:

What's the difference between lenght and distance ? You say that one is measure a of how strongly an optical system converges or diverges light

BUT

It is the same as Focus distance because stronger optical system converges light more and focus plane will be further away so there is 1 to 1 mapping between focus distance and focus length so i don't think this is right do differentiate two. I do think that you cannot decopule one from the other in real lens.

And in the article  about Focal_length it is written:

"For the special case of a thin lens in air, a positive focal length is the DISTANCE over which initially collimated (parallel) rays are brought to a focus, or alternatively a negative focal length indicates how far in front of the lens a point source must be located to form a collimated beam"

cheers,
Robert

Kevin Egan

unread,
Nov 1, 2019, 7:53:05 AM11/1/19
to pb...@googlegroups.com

I don't have the third edition in front of me but I'll attempt to wade into this conversation and hopefully add clarity.  Hi Matt!

Q. Is there a difference between length and distance?
A. Assuming we are not using the term "focal distance" or "focal length" and just talking about length distance and in space then for the purpose of this discussion, no, they're effectively the same thing.  In the case of describing a physical object like a fork it has distance in all three dimensions but you would consider its length to be the distance of the longest dimension.


Q. Then why do camera people use "focal distance" and "focal length" to describe different things?
A. Because people are bad at making names for things and these two confusing names stuck.  The "focal distance" is the distance (in a physical camera) from the physical lens to the image sensor.  The "focal length" is a property of a physical lens that describes how aggressively light bends when going through it.  Note that in the pbrt perspective camera model the computer science lens model is very simplified and acts more like a launch pad for rays rather than a physical lens that has a "focal length" (see below).


Q. OK, so what is the focalDistance variable passed into the PerspectiveCamera constructor?
A. Confusingly I believe this is different than either the "focal distance" or "focal length" above. This is the closest distance between the camera origin and the plane of focus for the camera.  Looking at perspective.cpp you can see that this is a simple model of a camera where we compute a ray by picking a point on the plane of focus, then we jitter the origin based on the "lensRadius".  This model is a convenient computer model for how to get rays that all meet up at the plane of focus but have different "lens" origins.  However, the "lens" in this case is more of a hack rather than something that models a true optical lens.  The "lens" here only has a radius, there is no description of how it bends light (in the model it does not bend light, it is more like a launch pad that provides an offset to the ray origin).  Also I believe the "lens" is sitting directly on top of the camera origin.  This is a very simple model that is convenient for making good looking pictures but if I follow the code correctly it is far from an accurate model of a lens in a real camera.


So if you use a perspective camera the "lens" sits right at the camera origin and doesn't bend light.  Because this "lens" is so different than a physical lens camera terms like "focal distance" or "focal length" do not really apply.

If you wanted to discover the focalDistance pbrt value you might have to edit the source code in perspective.h or camera.h to either print the value inside of the perspective camera constructor or make a publicly available accessor which could return the pbrt focalDistance variable.  Something like "Float getDistanceToFocusPlane() { return focalDistance; }"


Hope that helps!

Kevin


--
You received this message because you are subscribed to the Google Groups "pbrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pbrt+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pbrt/0e53f0c0-e7e3-4644-8982-4221e1a29f7c%40googlegroups.com.

Haarm-Pieter Duiker

unread,
Nov 4, 2019, 10:00:01 PM11/4/19
to pb...@googlegroups.com
The conversion between field of view and the focal length depends on the film back size. One of many possible references

See some of these scenes for examples that include the specification of the film back ‘diagonal’ length. 

--
You received this message because you are subscribed to the Google Groups "pbrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pbrt+uns...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages