MCPcopy
hub / github.com/JimmyHHua/opencv_tutorials / custom_hist

Function custom_hist

python/code_018/opencv_018.py:6–19  ·  view source on GitHub ↗
(gray)

Source from the content-addressed store, hash-verified

4
5
6def custom_hist(gray):
7 h, w = gray.shape
8 hist = np.zeros([256], dtype=np.int32)
9 for row in range(h):
10 for col in range(w):
11 pv = gray[row, col]
12 hist[pv] += 1
13
14 y_pos = np.arange(0, 256, 1, dtype=np.int32)
15 plt.bar(y_pos, hist, align='center', color='r', alpha=0.5)
16 plt.xticks(y_pos, y_pos)
17 plt.ylabel('Frequency')
18 plt.title('Histogram')
19 plt.show()
20
21
22src = cv.imread("./test.png")

Callers 1

opencv_018.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected