代码
import imutils
import cv2
image = cv2.imread('')
# loop over the angles to rotate the image
for angle in range(0, 360, 90):
# rotate the image and display it
rotated = imutils.rotate(image, angle=angle)
cv2.imshow("Angle=%d" % (angle), rotated)
cv2.waitKey(0)
效果
参考
jrosebr1/imutils: A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.
https://github.com/jrosebr1/imutils