import cv2
import matplotlib.pyplot as plt
import numpy as np
def show(image):
plt.imshow(image)
plt.axis('off')
plt.show()
def imread(image):
image = cv2.imread(image)
image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
return image
image = imread('image.jpg')
show(image)
image = imread('image.jpg')
(h,w) = image.shape[:2]
(cX,cY) = (w/2,h/2)
M = cv2.getRotationMatrix2D((cX,cY), 45, 1.0)
image = cv2.warpAffine(image, M, (w,h))
show(image)
image = imread('image.jpg')
(h,w) = image.shape[:2]
(cX,cY) = (w/2,h/2)
M = cv2.getRotationMatrix2D((cX,cY), -45, 1.0)
image = cv2.warpAffine(image, M, (w,h))
show(image)
image = imread('image.jpg')
(h,w) = image.shape[:2]
(cX,cY) = (w/2,h/2)
M = cv2.getRotationMatrix2D((cX,cY), 45, 2.0)
image = cv2.warpAffine(image, M, (w,h))
show(image)
image = imread('image.jpg')
(h,w) = image.shape[:2]
(cX,cY) = (w/2,h/2)
M = cv2.getRotationMatrix2D((cX,cY), 45, 0.5)
image = cv2.warpAffine(image, M, (w,h))
show(image)
image = imread('image.jpg')
(h,w) = image.shape[:2]
(cX,cY) = (w/2,h/2)
M = cv2.getRotationMatrix2D((cX-200,cY-200), 45, 1.0)
image = cv2.warpAffine(image, M, (w,h))
show(image)