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);
In python:
# import the necessary packages
import numpy as np
import cv2
# initialize the camera and grab a reference to the raw camera capture
vs = cv2.VideoCapture(0)
(ret, image_original) = vs.read()
image_rotated_90 = np.rot90(image_original)
image_rotated_180 = np.rot90(image_rotated_90)
# show the frame and press any key to quit the image frame
cv2.imshow("Frame", image_rotated_180)
cv2.waitKey(0)