pyEquirectRotate
support equirectangular rotation with pure python codes. π
You can rotate equirectangular images by rotating the surface of a sphere. π
This code supports (yaw, pitch, roll) rotation, described in this Wikipedia page.
I wrote the code to be numpy
-friendly. π
- (yaw, pitch, roll) rotation
- inverse rotation
-
numpy
-friendly - single point rotation
cd src
python demo.py
python demo2.py
This is a class that supports equirectangular rotations.
equirectRot1 = EquirectRotate(h, w, (yaw, pitch, roll))
rotated_image = equirectRot1.rotate(src_image)
Once you create an EquirectRotate
instance, you can re-use it when all other images are same image format; height, width, (yaw, pitch, roll)
After rotating and if you want to restore it, use .setInverse(True)
. It is described in demo.py
in more detail.
This is a function that supports a single point rotating on an equirectangular image.
rotated_point = pointRotate(h, w, i, j, (yaw, pitch, roll))
- I tested my code for non-equirectangular image, for example (N, N) square version image. It still works well, moreover in inverse mapping! π€©
- Some formulas are inspired by Paul Bourke's work. link
- If you want more awesome omnidirectional python codes, I recommend this repository!
- sunset1995/py360convert
- I've forked this
py360convert
, and addp2e
, perspective2equirectangular.
BlueHorn07/py360convert,p2e
- I've forked this
- sunset1995/py360convert
C/C++
Equirectangular Rotation - whdlgp/Equirectangular_rotate