| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 
 | import cv2
 img = cv2.imread('test.jpg')
 
 rows,cols,depth = img.shape
 
 print 'Please input angle to rotate counterclockwise:'
 degree = raw_input()
 degree = float(degree)
 
 M = cv2.getRotationMatrix2D((cols/2,rows/2),degree,1)
 dst = cv2.warpAffine(img,M,(cols,rows))
 
 cv2.namedWindow("Image")
 cv2.imshow("Image", dst)
 cv2.waitKey (0)
 cv2.destroyAllWindows()
 
 |