Skip to content

A python script to perform Geometric Transformation such as Perspective change, Zoom In/Out, Translation, Scaling, Shearing, Rotation and Flipping on an Image File.

License

Notifications You must be signed in to change notification settings

baijudodhia/img-geometric-transformation

Repository files navigation

Open In Colab

Image Geometric Transformations

This python file is used to perform various types of Geometric Transformation such as -

  1. Perspective Change - Zoom In/Zoom Out - Right/Left - X/Y Axis (8 functions)
  2. Translation - Positive/Negative - X/Y Axis (4 functions)
  3. Scaling - Positive/Negative - X/Y/XY Axis (6 functions)
  4. Shearing - Positive/Negative - X/Y Axis (2 functions)
  5. Rotation - X/Y/Z Axis (3 functions) (Angle Parameter in Degree)
  6. Flipping - X/Y Axis (2 functions)

All the functions have basic parameters of passing the Image, Image Width and Image Height along with passing of the Geometric Transformation FACTOR which is different for each type of transformation.

Using this Python Script -

  1. Download the "GeometricTransformations.py" file from the repository "img-geometric-transformation".
  2. Keep this file in same directory as your python files.
  3. Use "import GeometricTransformations as gt" in your python file.
  4. Use the functions with 'gt', for example - "gt.rotateX(image, imageWidth, imageHeight, 60)" will return a rotated image by +60 degrees along X Axis.

Testing the Python Script -

  1. Clone the repository.
  2. Add a test image (e.g. "test.jpg") to the folder.
  3. Open command line and change directory to same folder path as this repository.
  4. Run the following command and follow the instructions
> python main.py "path_to_image"
  1. Example
> python main.py "test.jpg"

About

A python script to perform Geometric Transformation such as Perspective change, Zoom In/Out, Translation, Scaling, Shearing, Rotation and Flipping on an Image File.

Topics

Resources

License

Stars

Watchers

Forks

Languages