import cv2
img = cv2.imread('cv2.flip().jpg')
h_flip = cv2.flip(img, 1) # 水平翻转
v_flip = cv2.flip(img, 0) # 垂直翻转
hv_flip = cv2.flip(img, -1) # 水平垂直翻转
cv2.namedWindow('Original Image', cv2.WINDOW_KEEPRATIO)
cv2.imshow('Original Image', img)
cv2.namedWindow('Horizontally Flipped', cv2.WINDOW_KEEPRATIO)
cv2.imshow('Horizontally Flipped', h_flip)
cv2.namedWindow('Vertically Flipped', cv2.WINDOW_KEEPRATIO)
cv2.imshow('Vertically Flipped', v_flip)
cv2.namedWindow('Horizontally & Vertically Flipped', cv2.WINDOW_KEEPRATIO)
cv2.imshow('Horizontally & Vertically Flipped', hv_flip)
cv2.waitKey(0)
cv2.destroyAllWindows()