import cv2
import sys
import numpy as np
import matplotlib.pyplot as plt

# 读取图像
print(sys.argv[1])
image = cv2.imread(sys.argv[1], cv2.IMREAD_COLOR)

# 计算直方图
hist = cv2.calcHist([image], [0], None, [256], [0, 256])

# 显示直方图
plt.plot(hist)
plt.xlim([0, 256])
plt.show()
