As far as i understand the math behind it, it is a kind of “simple” translation function. Each pixel (x,y) in the source image is transferd to a new u,v position in the output image.
Because of static mounting of the lenses one function should fit to all gear 360 cameras. So, i am really not good in math and i only understand a little of the gmic syntax…
Am i right would this be possible with gmic?
Has someone a ready function or a hint where to find a transformation formular for my aim?
There are other possibilities like hugin, but i think gmic would be a lot easy once prepared a script.
Given I know almost nothing about optics this is tricky for me. For now I can give a very basic example of fisheye to rectilinear (deliberately with no trig reductions):
The idea is much as you suggest; build a map of source pixel (x,y) locations for each output location (x,y). The -warp command uses that map to actually ‘pull’ the pixels in.
Maths wise this is assuming an ‘equisolid’ lens, where distance from the centre of your fisheye image (i.e. radius) is defined as r = 2f * sin (angle from optical axis/2). In the example that’s used to work out the original angle from the axis, then remap to a ‘normal’ rectilinear r = f * tan (angle). (Edit: actually it’s the backwards transform - this is just how my brain works!)
Clearly this isn’t enough explanation for either the G’MIC commands or the maths. I hope to have time to do more with it later, but can’t promise anything
So, i found that @garagecoder made a perfect script to deal with one fish eye. The syntax of scripting such complex equotations is still hard to read for me. But i am trying expand the given code to my needs.