Skip to content
This repository was 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 3 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
17 changes: 17 additions & 0 deletions Image-Processing/image _rotation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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)


##.shape will give you height and width of image
height, width = img.shape[0:2]
##getrotationmatrix2d will create a rotation matrix "(center, angle, scale)" => arguments
rotationMatrix = cv2.getRotationMatrix2D((width/2, height/2), 90, .5)
## the wrapAffine function will rotate image "(img, rotationMatrix, (width, height))" => arguments
rotatedImage = cv2.warpAffine(img, rotationMatrix, (width, height))

cv2.imshow('Rotated Image', rotatedImage)

cv2.waitKey(0)