Answers for "cv2 warpaffine rotate"

0

cv2 warpaffine rotate

import numpy as np
import cv2

def rotate_image(image, angle):
  image_center = tuple(np.array(image.shape[1::-1]) / 2)
  rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
  result = cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR)
  return result
Posted by: Guest on July-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language