In [1]:
import cv2

In [2]:
img = cv2.imread('data/src/lena.jpg')
print(type(img))


<class 'numpy.ndarray'>

In [3]:
print(img.shape)


(225, 400, 3)

In [4]:
img_rotate_90_clockwise = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE)
cv2.imwrite('data/dst/lena_cv_rotate_90_clockwise.jpg', img_rotate_90_clockwise)


Out[4]:
True

In [5]:
img_rotate_90_counterclockwise = cv2.rotate(img, cv2.ROTATE_90_COUNTERCLOCKWISE)
cv2.imwrite('data/dst/lena_cv_rotate_90_counterclockwise.jpg', img_rotate_90_counterclockwise)


Out[5]:
True

In [6]:
img_rotate_180 = cv2.rotate(img, cv2.ROTATE_180)
cv2.imwrite('data/dst/lena_cv_rotate_180.jpg', img_rotate_180)


Out[6]:
True