GithubHelp home page GithubHelp logo

blendhome / rotate_3d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eborboihuc/rotate_3d

0.0 0.0 0.0 15.2 MB

3D Rotation image along specific axes

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

rotate_3d's Introduction

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

rotate_3d's People

Contributors

eborboihuc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.