python图像旋转

import cv2

img = cv2.imread('wintercome.jpeg')
rows,cols,_ = img.shape

h = min(rows,cols)
img = img[0:h,0:h]

mat = cv2.getRotationMatrix2D((h/2,h/2),90,1)
dst = cv2.warpAffine(img,mat,(h,h))
cv2.imshow("1",img)

mat = cv2.getRotationMatrix2D((h/2,h/2),45,1)
img = cv2.warpAffine(img,mat,(h,h))

cv2.imshow("2",dst)
cv2.imshow("3",img)
#cv2.waitKey(0)

python图像旋转_第1张图片

  • center – Center of the rotation in the source image.

  • angle – Rotation angle in degrees. Positive values mean counter-clockwise rotation (the coordinate origin is assumed to be the top-left corner).

  • scale – Isotropic scale factor.

 

你可能感兴趣的:(空间艺术Raumkunst)