From 2d5bbadc8485c59e14b621825bb48a2cca0c6889 Mon Sep 17 00:00:00 2001 From: Yash Patel <49101492+ryuk156@users.noreply.github.com> Date: Sun, 16 Aug 2020 11:54:03 +0530 Subject: [PATCH 1/4] Create rotate_image.py --- rotate_image.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 rotate_image.py diff --git a/rotate_image.py b/rotate_image.py new file mode 100644 index 00000000..4aa5649c --- /dev/null +++ b/rotate_image.py @@ -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) From e14f7ba4d7836c244421e73a50f98d9e23bd0ea7 Mon Sep 17 00:00:00 2001 From: Yash Patel <49101492+ryuk156@users.noreply.github.com> Date: Sun, 16 Aug 2020 11:54:45 +0530 Subject: [PATCH 2/4] Delete rotate_image.py --- rotate_image.py | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 rotate_image.py diff --git a/rotate_image.py b/rotate_image.py deleted file mode 100644 index 4aa5649c..00000000 --- a/rotate_image.py +++ /dev/null @@ -1,17 +0,0 @@ -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) From e64ef3a7c97f647a73ede3f221ea0dc922849593 Mon Sep 17 00:00:00 2001 From: Yash Patel <49101492+ryuk156@users.noreply.github.com> Date: Sun, 16 Aug 2020 11:55:32 +0530 Subject: [PATCH 3/4] Create image _rotation.py --- Image-Processing/image _rotation.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Image-Processing/image _rotation.py diff --git a/Image-Processing/image _rotation.py b/Image-Processing/image _rotation.py new file mode 100644 index 00000000..4aa5649c --- /dev/null +++ b/Image-Processing/image _rotation.py @@ -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) From ef2f6532fa7c5516c5a7d9feaf33b404953d86a5 Mon Sep 17 00:00:00 2001 From: Yash Patel <49101492+ryuk156@users.noreply.github.com> Date: Sun, 16 Aug 2020 16:06:53 +0530 Subject: [PATCH 4/4] Update image _rotation.py --- Image-Processing/image _rotation.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Image-Processing/image _rotation.py b/Image-Processing/image _rotation.py index 4aa5649c..47b15a5c 100644 --- a/Image-Processing/image _rotation.py +++ b/Image-Processing/image _rotation.py @@ -1,17 +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) - - -##.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)) - +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)