Create equirectangle Panorama from gear 360 images


(Lubeda) #1

i am wondering if it is posible to transform raw images from a gear 360 camera like this ( to a projected equirectangular image (Panorama).

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.




Yes that’s certainly possible, see for example this post about re-projection

Do you have any information about the maths involved? Otherwise working that out could take a while…

Edit: I should add that a larger/clearer example input image would help!

(Lubeda) #3

I found this: which describes the nececarry steps, but i am not able to translate this to a formula and also no to code this in a gmic script.

But this seems to be the right direction.



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):

example_unfisheye :
  100%,100%,1,3,0 -sh. 0
  -f. "
-rm. -warp.. .,0,2 -rm.

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 :anguished:

(Mica) #5

Not to detract from GMIC at all, but given the lens is fixed (correct?), you can probably script this in hugin very easily.

I bet if you uploaded a sample, you’d have several solutions :wink:

(Lubeda) #6

The script from @garagecoder is a very good base to start from.
I made a quick test which is shown here:

The first shown image is the expected result, the second the source image, the third the result from the script.

As you see in the first source image the two lenses are fix focus lenses with a field of view of 195°.


(Lubeda) #7

Diving deeper into gmic…

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.