how to understand the lens distortion and shift values?

35 views
Skip to first unread message

neil sackdoor

unread,
Dec 9, 2025, 8:55:42 PM (3 days ago) Dec 9
to PTGui Support
hi

I'm trying recreate a stitched panoramic image in After Effects and hoping there is a way to reproduce the lens distortion calculated by PTGui.
I'm really hoping someone might be able to elucidate what exactly the a, b and c values are, and how I might translate them to something After Effects will understand.
The project i'm working on is using images shot on an Canon R52 with an RF 15-35mm lens at 15mm

My options for lens correction in After Effects are:
  1. The basic 'optics compensation' effect does what I assume is simple barrel/pin-cushion correction. It uses a single value called FOV (range 0-90˚) to adjust the amount of distortion. It also has a lens centre [X,Y] for offseting the optical centre.
    As a reference, for an eyeball correction on my images I would use an FOV value of about 27˚ inverse (simple barrel correction)
  2. the next option is an effect called FT-Lens distortion. It uses values for 'Distortion' (range -1 to 1) and also "Cubic Distortion" (range -1 to 1) which does seem to be able to do the classic moustache distortion.
    In my case I'd use apx values distortion: -0.03 and cubic: = 0.01  (https://aescripts.com/ft-lens-distortion/?srsltid=AfmBOopxxdYdRUlNdDhmx34ojTteM0UnBFqmVzCDX7I3QwkVXy1wgkMh)
  3. the most sophisticated option is 'Syntheyes Advanced Distortion' which has a huge number of increasingly mystifying distortion correction options. The most basic 'classic' distortion parameters include "Distortion", "Cubic", "Quartic" with ranges (-20000 to 20000) it also has values for "Eccentricity" and "Vertical Scale" which I've not used and a "Lens Center" offset. Doing a lens calibration using Syntheyes gave me values for Distortion: -28.726 Cubic: 6.797 Quartic: 0.561
So, having created the panorama in PTGui, I'm getting a very nice stitch that has the following a, b, c distortion values:
a.  0.00541762.       b.  -0.0139552.      c.  -0.0160456
I'm really hoping someone might be able to help me understand what these values represent, and how I might map them to values in one of the three distortion effects listed above. I was really hoping it would be as simple as  a,b,c, = distortion, cubic, quartic but alas, I don't think its that simple.

and then the optical centre offset, these are listed by PTGui as percentages
U. -0.529441%.     V. -0.243984%
but percentages of what?, the original image size (in pixels)? or is it FOV?
I tried a very rough by-eye test in after effects and could find no obvious correlation between the PTGui % values and the amount the images needed to shift to match the stitched pano.

OK, I realise that is a lot (it's totally doing my head in) but hopefully someone a whole lot smarter than me can help point me in the right direction...

thanks../neil

PTGui Support

unread,
Dec 10, 2025, 3:19:52 AM (2 days ago) Dec 10
to pt...@googlegroups.com
Hi Neil,

PTGui uses the panotools lens correction model. See
https://wiki.panotools.org/Lens_correction_model

The crop and shift parameters are stored as shift and scale invariant
percentages. For more information and sample code see 6.43:
https://ptgui.com/faq#6_43

Kind regards,

Joost Nieuwenhuijse
www.ptgui.com

On 12/10/25 02:55, neil sackdoor wrote:
> hi
>
> I'm trying recreate a stitched panoramic image in After Effects and
> hoping there is a way to reproduce the lens distortion calculated by PTGui.
> I'm really hoping someone might be able to elucidate what exactly the a,
> b and c values are, and how I might translate them to something After
> Effects will understand.
> The project i'm working on is using images shot on an Canon R52 with an
> RF 15-35mm lens at 15mm
>
> My options for lens correction in After Effects are:
>
> 1. The basic 'optics compensation' effect does what I assume is simple
> barrel/pin-cushion correction. It uses a single value called FOV
> (range 0-90˚) to adjust the amount of distortion. It also has a lens
> centre [X,Y] for offseting the optical centre.
> As a reference, for an eyeball correction on my images I would use
> an FOV value of about 27˚ inverse (simple barrel correction)
> 2. the next option is an effect called FT-Lens distortion. It uses
> values for 'Distortion' (range -1 to 1) and also "Cubic Distortion"
> (range -1 to 1) which does seem to be able to do the classic
> moustache distortion.
> In my case I'd use apx values distortion: -0.03 and cubic: = 0.01
> (https://aescripts.com/ft-lens-distortion/?
> srsltid=AfmBOopxxdYdRUlNdDhmx34ojTteM0UnBFqmVzCDX7I3QwkVXy1wgkMh)
> 3. the most sophisticated option is 'Syntheyes Advanced Distortion'
> --
> You received this message because you are subscribed to the Google
> Groups "PTGui Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ptgui+un...@googlegroups.com
> <mailto:ptgui+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> ptgui/173cb55d-6ffa-4d85-87f4-5e5dc67714b1n%40googlegroups.com <https://
> groups.google.com/d/msgid/
> ptgui/173cb55d-6ffa-4d85-87f4-5e5dc67714b1n%40googlegroups.com?
> utm_medium=email&utm_source=footer>.

Erik Krause

unread,
Dec 10, 2025, 8:43:38 AM (2 days ago) Dec 10
to pt...@googlegroups.com
Am 10.12.25 um 02:55 schrieb neil sackdoor:

> I'm really hoping someone might be able to elucidate what exactly the a, b
> and c values are, and how I might translate them to something After Effects
> will understand.

The lens correction parameters a, b and c basically are the values of a
polynomial defining a curve. I suspect After Effects also uses a curve,
as "Cubic" (power of 3) and "Quartic" (power of 4) suggest. However,
converting from one polynomial to another is not trivial, and of course
you would need the exact meaning of the values in After Effects.

But if your goal is correction of some images or even a video, there
might be a simpler solution. Once you know the correction parameters in
PTGui you can save them as a template and use that in the Batch Builder.
To correct a video you would have to split it in single images (f.e.
using ffmpeg), batch-remap them using PTGui and reassemble them into a
video.

--
Erik Krause
Reply all
Reply to author
Forward
0 new messages