Rotate 3d Save

3D Rotation image along specific axes

Project README

Perspective Transformation along specific axes

Animation

Rotate along X axis and translate 5 pixel along X axis

Rotate along XZ axis

Prerequisites

  • Linux
  • Python 2.7 with numpy
  • OpenCV 2.4.9

Usage

Change main function with ideal arguments

python demo.py [path of the image] [degree to rotate] ([ideal width] [ideal height])

e.g., Example of rotating an image along yz-axis from 0 to 360 degree with a 5 pixel shift in +X direction

- rotated_img = it.rotate_along_axis(phi = ang, dx = 5)
+ #rotated_img = it.rotate_along_axis(phi = ang, dx = 5)

- #rotated_img = it.rotate_along_axis(phi = ang, gamma = ang)
+ rotated_img = it.rotate_along_axis(phi = ang, gamma = ang)

Then

python demo.py images/000001.jpg 360

Parameters:

it = ImageTransformer(img_path, img_shape)
it.rotate_along_axis(theta=0, phi=0, gamma=0, dx=0, dy=0, dz=0):
  • img_path : the path of image that you want rotated
  • shape : the ideal shape of input image, None for original size.
  • phi : the rotation around the y axis
  • gamma : the rotation around the z axis (basically a 2D rotation)
  • dx : translation along the x axis
  • dy : translation along the y axis
  • dz : translation along the z axis (distance to the image)

Acknowledgments

Code ported and modified from jepson and stackoverflow. Thanks for their excellent work!

Author

Hou-Ning Hu / @eborboihuc

Open Source Agenda is not affiliated with "Rotate 3d" Project. README Source: eborboihuc/rotate_3d
Stars
142
Open Issues
4
Last Commit
3 years ago
License

Open Source Agenda Badge

Open Source Agenda Rating