You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
436 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import sys
import cv2
import numpy as np
import matplotlib.pyplot as plt
def mirror_flip(img_path, type):
img = cv2.imread(img_path, 1)
result = cv2.flip(img, type)
cv2.imwrite('./output/mirror_flip.jpg', result)
'''
输入:图片地址,镜像类型(1,0,-1)
输出type=1 水平镜像
type=0 垂直镜像
type=-1 对角镜像
'''
if __name__ == '__main__':
mirror_flip(sys.argv[1], eval(sys.argv[2]))