Transforming Between Projections

  • Seth Berrier
    Seth Berrier

    Hi there!

    I'm a new user of Hugin (and vicariously Panotools) and I'm interested in using it to compute parameters of lens distortion.  In particular, I have a good fisheye lens and I want to be able to map from this fisheye lens to some more easily viewed projections like equirectangular or cylindrical projections.  However, I'm having lots of difficulty getting my head around the math for each of these projections.  Each projection as it's talked about in the Panotools wiki or in Mathworld are in terms of different parameters that are tough to put in terms of each other (angle between optical axis and point in real world vs. longitude and latitude on the unit sphere).

    Anyways, what I'm looking for is code to transform between an ideal fisheye projection to other projections (equirectangular, cylindrical, rectilinear, etc).  I know this must be buried in the Panotools code or in the Hugin code somewhere but so far I haven't be able to find it.  Can anyone point me in the right direction?


    • Bruno Postle
      Bruno Postle

      It's buried though I'm not entirely sure where.  Possibly I'm the only person monitoring this forum, so you might get a more useful response posting to one of the mailing lists, such as panotools-devel.

      If you just want to use existing tools, this is easy enough.  Just determine the lens parameters (fov, a,b,c) for your lens and you can script the transformation into any projection using one of the command-line stitchers such as nona.

    • Rob Platt
      Rob Platt

      This question was recently answered on the pantools-devel list, which is a bit more active than this one.

      If you relly want to get into the source code:

      The choice of the mapping and setup to start the work is made in remap.c, and in adjust.c. the real work is in math.h. specificly, look in rect_erect() and in sphere_tp_erect()

      If you just want to convert images between the projections, try out a tool like PTGui, PTAssembler or  PTMac.
      The various web sites dedicated to panotools have lots of explainations of the various projections involved.