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

Thread: Algorithm for calculating number of frames in a panorama?

  1. #1
    New Member
    Join Date
    Jan 2011
    Posts
    1

    Algorithm for calculating number of frames in a panorama?

    Hello all,
    I'm a student from University of California, San Diego, working on a project where we are trying to implement a panoramic photography function. I know there is a really good calculator on this website, but I was wondering if someone can explain, or point me in the right direction, about the math behind calculating the number of frames from a fixed point at a fixed zoom with a variable overlap as well as camera movement in degrees. Any help would be greatly appreciated and any person who contributes any information used in the project will be fully credited for their contribution!
    Thanks,
    Trevor

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

    Re: Algorithm for calculating number of frames in a panorama?

    Hi Trevor, let me see if I can help. The panorama calculator on this site performs the nearly reverse of what you appears to want. It calculates the required focal length need for a panorama with a given number of photos, percent overlap and angle of view. To start, this site's calculator uses the following formula:

    n = required number of frames
    overlap_fraction = fraction of overlap between adjacent photos (i.e., 0.2 would represent 20% overlap)
    focal = required focal length of each individual frame
    effective_focal = focal length that would otherwise be required to capture the panorama's full angle of view in one shot (along the frame's longest dimension)

    EQN1: focal = effective_focal * [ overlap_fraction + n * (1-overlap_fraction) ]
    So, in your case, you want to find the number of frames required for a given focal length, percent overlap and angle of view. You can rewrite EQN1 above as:

    EQN2: n = focal/effective_focal - overlap_fraction / (1-overlap_fraction)

    So now you need to convert the effective_focal into an angle of view. The angle of view (aov_hor, in degrees) along the sensor's longest dimension (sensor_width) can be found by:

    EQN3: aov_hor = (360/Pi) * arctan[ sensor_width / (2*effective_focal) ]

    All length units are in millimeters. For a standard "full frame" 35mm camera, the sensor height is 24mm and the width is 36mm. You can therefore rewrite the above formula and get the effective focal length as a function of angle of view:

    EQN4: effective_focal = sensor_width / [ 2 * tan( aov_hor * Pi/360 ) ]

    Plugging EQN4 into EQN2 gives:

    n = 2 * focal * [ tan( aov_hor*Pi/360 ) / sensor_width ] - overlap_fraction / ( 1-overlap_fraction )

    In this case, n would always need to be rounded up to the nearest integer. For example, if n came out to 4.3, you would need n=5 frames.

    That should be pretty darn close to what you want. If I've made a mistake, please let me know. The only thing left to do is to figure out how a given percent rotation correlates with a given percent overlap with the prior photo (for a given focal length). I'll leave that up to you though -- it is a class, after all

  3. #3
    Shadowman's Avatar
    Join Date
    Dec 2009
    Location
    WNY
    Posts
    36,717
    Real Name
    John

    Re: Algorithm for calculating number of frames in a panorama?

    Tiang,

    Are you trying to calculate the number of frames in a 360 degree panorama? I think this would be more interesting since the value would change for every camera.

Posting Permissions

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