美文网首页
09图片旋转

09图片旋转

作者: 犬夜叉写作业 | 来源:发表于2019-07-14 12:45 被阅读0次
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)# mat rotate :( center , angle , scale) :(x中点,y中点),45°,缩放0.5
#100*100 25 
dst = cv2.warpAffine(img,matRotate,(height,width))
cv2.imshow('dst',dst)
cv2.waitKey(0)

相关文章

网友评论

      本文标题:09图片旋转

      本文链接:https://www.haomeiwen.com/subject/pupbkctx.html