def hist_lines(image, start, end):
scale = 4
height = 1080
result = np.zeros((height, 256 * scale, 1))
hist = cv2.calcHist([image], [0], None, [256], [start, end])
cv2.normalize(hist, hist, 0, height, cv2.NORM_MINMAX)
hist = np.int32(np.around(hist))
for x, y in enumerate(hist):
cv2.rectangle(result, (x * scale, 0), ((x + 1) * scale, y), (255), -1)
result = np.flipud(result)
return result
评论列表
文章目录