【发布时间】:2021-04-13 15:28:25
【问题描述】:
import cv2
import numpy as np
import matplotlib.pyplot as plt
def my_histogram(img, bins, range):
hist =
return hist
我需要在不使用 np.histogram 或其他直方图函数的情况下填写 hist
img = cv2.imread('sample.jpg')
img_g = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
hist = my_histogram(img_g, 256, [0,256])
plt.plot(hist)
plt.xlim([0,256])
plt.show()
【问题讨论】:
标签: python image function numpy histogram