1.旋转
dir_path='/Users/xxxx/Desktop/Share Folder/png&dat/timg.jpeg‘
img=cv2.imread(dir_path)
imgInfo = img.shape
height= imgInfo[0]
width = imgInfo[1]
deep = imgInfo[2]
matRotate = cv2.getRotationMatrix2D((height*0.5, width*0.5), 45, 1)
dst = cv2.warpAffine(img, matRotate, (height, width))
原图:
旋转后的图像:
2.翻转
dir_path='/Users/xxxx/Desktop/Share Folder/png&dat/timg.jpeg‘
img=cv2.imread(dir_path)
imgInfo = img.shape
height= imgInfo[0]
width = imgInfo[1]
deep = imgInfo[2]
matRotate = cv2.getRotationMatrix2D((height*0.5, width*0.5), 180, 1)
dst = cv2.warpAffine(img, matRotate