Skip to content

Fast and Simple Equirectangular Rotating python code 😎

Notifications You must be signed in to change notification settings

BlueHorn07/pyEquirectRotate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

pyEquirectRotate

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

Demo Result

demo

Quick Start

cd src
python demo.py
python demo2.py

Code Detail

class EquirectRotate

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.

function pointRotate

This is a function that supports a single point rotating on an equirectangular image.

rotated_point = pointRotate(h, w, i, j, (yaw, pitch, roll))

Further Reading

  • 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!
  • C/C++ Equirectangular Rotation - whdlgp/Equirectangular_rotate

About

Fast and Simple Equirectangular Rotating python code 😎

Topics

Resources

Stars

Watchers

Forks

Languages