图片旋转

import cv2
import numpy as np

img = cv2.imread('image0.jpg', 1)
cv2.imshow('src', img)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
# 获取旋转矩阵(旋转的中心点, 旋转的角度, 缩放的系数)
matRotate = cv2.getRotationMatrix2D((height*0.5, width*0.5), 45, 0.5)
dst = cv2.warpAffine(img, matRotate, (height, width))
cv2.imshow('dst', dst)
cv2.waitKey(0)

 

 

posted @ 2019-07-19 21:02  青衫客36  阅读(118)  评论(0编辑  收藏  举报