I need to rotate an image by either 90, 180 or 270 degrees. In OpenCV4Android I can use:
Imgproc.getRotationMatrix2D(new Point(center, center), degrees, 1);
Use the numpy.rot90,if you want 180 degrees,just do it twice.
numpy.rot90
import numpy as np import cv2 img = cv2.imread('img.png',1) cv2.imshow('',img) cv2.waitKey(0) img90 = np.rot90(img) cv2.imshow('',img90) cv2.waitKey(0)