提示:担心找不到本站?在百度搜索 笔书斋 | 也可以直接 收藏本站

输入小说名 可以少字但不要错字

天生尤物【快穿】高H 姜可(H) 深情眼

4.2.3 图像旋转

      4.2.3 图像旋转
    图像旋转的物理意义,可以理解为摄像头或者相机和物体的夹角发生了变化。
    img=cv2.imread("../picture/pig.jpg")
    img1 = cv2.cvtcolor(img, cv2.color_bgr2rgb)
    rows,cols,_ = img.shape
    matrix = cv2.getrotationmatrix2d((cols/2,rows/2),90,1)
    img2 = cv2.warpaffine(img1,matrix,(cols,rows))
    matrix = cv2.getrotationmatrix2d((cols/2,rows/2),180,1)
    img3 = cv2.warpaffine(img1,matrix,(cols,rows))
    matrix = cv2.getrotationmatrix2d((cols/2,rows/2),270,1)
    img4 = cv2.warpaffine(img1,matrix,(cols,rows))
    如图4-9所示,把图像分别旋转90度、180度和270度,旋转的中心是原图像的中心。