parser = argparse.ArgumentParser()
‘’‘名字,type参数类型,default默认值,help:参数描述,metavar’’’
parser.add_argument(’-input’, default=r’test_images/19.jpg’, help=‘input image path’)
# parser.add_argument(’–input’, ‘-i’ default=r’test_images/19.jpg’, help=‘input image path’) # ‘–input’ 参数, ‘-i’ 简短参数
parser.add_argument(’-output’, default=r’output_images/output.jpg’, help=‘output image path’)
parser.add_argument(’-s’, default=300, type=float, help=‘the scale (reference value)’)
parser.add_argument(’-n’, default=3, type=int, help=‘the number of scale’)
parser.add_argument(’-d’, default=2, type=float, help=‘the dynamic, the smaller the value, the higher the contrast’)
parser.add_argument(’–no_cr’, action=‘store_true’, help=‘do NOT do cr’)
‘’‘parse_args(args=None, nampespace=None)–args参数名称,namespace赋值’’’
args = parser.parse_args()
im_out = MSRCR(args.input, args.s, args.n, args.d, not args.no_cr)
cv2.imwrite(args.output, im_out[:, :, (2, 1, 0)])
print(parser.parse_args())