import cv2
import numpy as np
import matplotlib.pyplot as plt
def my_histogram(img, bins, range):
hist =
return hist
I need to fill out hist without using np.histogram or other histogram function
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()