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.

19 lines
369 B

import sys
import cv2
import numpy as np
import matplotlib.pyplot as plt
def bgr2gray(img_path):
img = cv2.imread(img_path, 1) # 读取图片
gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imwrite('./output/Gray.jpg', gray_image)
'''
输入:彩色图片的地址
输出:灰度图片
'''
if __name__ == '__main__':
bgr2gray(sys.argv[1])