Ask Your Question

Revision history [back]

This works for me now :)

import cv2
import matplotlib.pyplot as plt
img = cv2.imread('1.jpg',0)
rows,cols = img.shape
M = cv2.getRotationMatrix2D((cols/2,rows/2),-40,1) # the format is cv2.getRotationMatrix2D(center, angle, scale) 
dst = cv2.warpAffine(img,M,(cols,rows),flags=cv2.INTER_CUBIC)
plt.imshow(dst)