Basically what I'd need is a way to take each disc in that first image, and stretch each of the pixel rows horizontally with such an amount that they all end up just as wide as the equator. Obviously the stretch factor would depend on how far away that particular pixel row is from the "equator row". Then I just need to stitch both squares et voilŕ, I'm back at the equirectangular!
For each row of pixels, the stretch factor would be N
equator / N
actual, with
- Nequator being the number of pixels on the equator, which is known, and
- Nactual being the sine of the angle that has that particular row height (measured from the equator, as a fraction of the height of the poles) as its cosine.
That last bit sounds complicated but actually you just take the sine of acos (H
actual / H
pole), with
- Hactual being the vertical distance between the equator row and the actual row, and
- Hpole being the vertical distance between the equator and the pole, which is known (and identical to Nequator since we're talking about a perfect circle here!)
But "simple" as that may sound, I have no knowledge of coding, and no idea whatsoever of how I can turn this into something that actually does the thing I want, no matter how long I ponder on it...