close

import numpy as np

import cv2

 

def rotate(img, angle, center=None, scale=1.0):

      testImg = cv2.imread(img)

      (h, w) = testImg.shape[:2]

      if center is None:

            center = (w/2, h/2)

      M = cv2.getRotationMatrix2D(center, angle, scale)

      rotatedImg = cv2.warpAffine(testImg, M, (w, h))

      cv2.imshow('result', rotatedImg)

      cv2.waitKey(0)

 

rotate('test.jpg', -90)

 

 

※查詢其他OpenCV用法如下※

openCV應用總整理: 點擊我

arrow
arrow

    楓綺 發表在 痞客邦 留言(0) 人氣()