最近用到了图像旋转,有transpose和filp方法,具体旋转方式如下:
#-*- coding:utf-8 _*-
"""
@file: transpose.py
@time: 2019/01/08
"""
import cv2
import numpy as np
img=cv2.imread('d_1.jpg')
img_trans=cv2.transpose(img)
img_flip0=cv2.flip(img,0)
img_flip1=cv2.flip(img,1)
img_flip_1=cv2.flip(img,-1)
cv2.imshow('img',img)
cv2.imshow('img_trans',img_trans)
cv2.imshow('img_flip0',img_flip0)
cv2.imshow('img_flip1',img_flip1)
cv2.imshow('img_flip_1',img_flip_1)
cv2.waitKey(0)
cv2.destroyAllWindows()
最后获得结果如图所示: