Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

ImageProcessing _image_rotation #106

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Image-Processing/image _rotation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import cv2 ##import the module
img = cv2.imread("rose.jpg") ##read your image
cv2.imshow('Original Image', img) ##this will display the image original image
cv2.waitKey(0)
height, width = img.shape[0:2] ##.shape will give you height and width of image
rotationMatrix = cv2.getRotationMatrix2D((width/2, height/2), 90, .5) ##getrotationmatrix2d will create a rotation matrix "(center, angle, scale)" => arguments
rotatedImage = cv2.warpAffine(img, rotationMatrix, (width, height)) ## the wrapAffine function will rotate image "(img, rotationMatrix, (width, height))" => arguments
cv2.imshow('Rotated Image', rotatedImage)
cv2.waitKey(0)