Skip to content

MeghaShyam26/rotate_3d

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

3D Rotation image along specific axes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%