Helpful Posts Helpful Posts:  0
Results 1 to 7 of 7

Thread: Required focal length calculator

  1. #1
    New Member
    Join Date
    Apr 2008
    Posts
    3

    Required focal length calculator

    I am looking for the equation used to determine the required focal length given the subject distance (S1), the subject size (h) and camera type. I have derived a formula, but it does not agree with the one found in https://www.cambridgeincolour.com/tu...era-lenses.htm.


    Attached below is a diagram which explains the variables. (The original diagram came from http://en.wikipedia.org/wiki/Angle_of_view).
    Code:
    Let s = the sensor size in its longest dimension
    Let h = the longest subject dimension (equals subject height in portrait mode)
    Let f = the focal length
    Let S1 = the distance from the lens to the subject
    Let S2 = the distance from the lens to the sensor
    Let alpha = the angle of view
    I believe the equations that relate these variables are

    Code:
    EQN1: alpha/2 = arctan(s / (2*S2)) = arctan(h / (2*S1))
    EQN2: 1/f = 1/S1 + 1/S2
    So, for example, suppose I wanted to photograph a 0.5ft-tall bird from 50ft away with a camera with a 1.6x lens multiplier.

    On a 35mm camera the horizontal sensor length is 36mm, so on a camera with a 1.6x multiplier, the sensor is 36/1.6 = 22.5mm long = s.

    S1 = 50ft.

    From EQN1, S2 = s*S1 / h = 22.5mm * 50ft / 0.5ft = 2250 mm.
    From EQN2, it appears you need a lens with focal length f = 1961mm (Yikes!)

    The calculator on
    https://www.cambridgeincolour.com/tu...era-lenses.htm says you need a lens with focal length 1817.9 mm.

    I would really appreciate it if someone could explain the discrepancy. Thanks!
    Attached Images Attached Images
    Last edited by root; 28th April 2008 at 08:18 PM.

  2. #2
    Administrator
    Join Date
    Apr 2008
    Location
    California, USA
    Posts
    1,473
    Real Name
    Sean

    Re: Required focal length calculator

    I will add a more detailed explanation shortly, but at first glance the reason for your discrepancy is because the angle of view equation you are using is an approximation for situations where the focusing distance is very large compared to the focal length. The focal length calculator used on this website does not make that approximation, so it applies more accurately to a broader range of scenarios.
    Last edited by McQ; 28th April 2008 at 08:20 PM.

  3. #3
    Administrator
    Join Date
    Apr 2008
    Location
    California, USA
    Posts
    1,473
    Real Name
    Sean

    Re: Required focal length calculator

    Here's a more detailed breakdown of the equations and assumptions that went into this focal length calculator. I will use the same variable names from your post. All we need is the following equation:

    Code:
    alpha/2 = arctan(s / (2*S2)) = arctan(h / (2*S1))
    Which simplifies to:
    Code:
    s/S2 = h/S1
    So far nothing has changed, but here's where your calculation begins to differ. You are assuming that S2 = focal length, which is an approximation for situations where the focusing distance is large compared to the focal length. S2 is more accurately defined as the distance from the sensor to the 2nd nodal point of the lens, which can be calculated from the following equation:

    Code:
    S2 = D*f / (D-f)
    where: D = distance at which the lens is focused
    Very technical note: even the above equation makes an approximation by assuming that the entrance and exit pupils of the lens are located at the 1st and 2nd nodal/principal points. It is still an improvement though. Also, strictly speaking, D is the distance from the subject to the 1st principal point of the lens, not the distance from sensor to subject.

    Using the above improved approximation, the focal length can therefore be estimated using the following simplified expression:
    Code:
    f = s*D / (h+s)
    Of course, in relative % error the difference between the improved approximation and your calculation is small for all practical purposes. However, the discrepancy increases as the focusing distance (D) decreases.

    Let me also add that I can certainly make mistakes; although all calculators on this website were reasonably scrutinized, finding errors in them is not out of the question. If you notice something you think is in error, by all means bring it up in a discussion such as this one.

  4. #4
    xeliex's Avatar
    Join Date
    Apr 2008
    Location
    Philadelphia
    Posts
    93
    Real Name
    Elie

    Re: Required focal length calculator

    Ah!!!

    Stuff that gets my adrenaline pumping!

    I am turning into such a geek lately thanks to CIC

  5. #5
    New Member
    Join Date
    Apr 2008
    Posts
    3

    Re: Required focal length calculator

    Thank you for the quick reply, McQ, but I must be missing something here.
    S1 is the distance from the lens to the subject.
    "D is the distance from the subject to the 1st principal point of the lens."
    I agree the 1st principal point is different than the center of the lens, though if I understand correctly, under the "thin-lens approximation" they are the same.

    If the web calculator is using the thin-lens approximation then your equation and my equation for f are the same because

    Code:
    S2 = D*f / (D-f)
    is identical to

    Code:
    EQN2: 1/f = 1/S1 + 1/S2
    if S1=D.

    If the web calculator is not using the thin-lens approximation then I'd like to know how D is determined by the web calculator.

    To put this all in concrete terms, let's plug numbers into your formula:
    Code:
    f = s*D / (h+s)
    According to the web calculator, f=1817.9 mm. s=22.5mm. h=0.5ft=152.4mm.
    So D= f*(h+s)/s = 14131mm = 46.4ft.
    This would imply S1-D = 50-46.4 = 3.6ft. How can the 1st principal point of the lens be 3.6 ft closer to the subject than the center of the lens? That sounds fishy.

  6. #6
    Administrator
    Join Date
    Apr 2008
    Location
    California, USA
    Posts
    1,473
    Real Name
    Sean

    Re: Required focal length calculator

    I must say that I was baffled why there is a difference, because as you point out, it appears our equations are actually all identical.

    In short: everything is now fine, there was a misentered digit after the decimal in the html form (not the javascript calculator, which I checked and checked). This caused the result you observed, but only for situations where one selected a 1.6X sensor size with a small subject. This had the effect of causing increasing error as the subject size (h) approached the sensor size (s); in your example the subject was just 6-7X the size of the sensor in its longest dimension, causing the error to become more apparent. Good to catch corner cases like this. Everything is otherwise identical.

  7. #7
    New Member
    Join Date
    Apr 2008
    Posts
    3

    Re: Required focal length calculator

    Thanks for your help, McQ. Now all I have to do is save enough pennies to buy a 1961mm lens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •