# 绘制三通道直方图 def hsv_histogram(image_3chanal): # 按R、G、B三个通道分别计算颜色直方图 b_hist = cv.calcHist([image_3chanal], [0], None, [256], [0, 180]) g_hist = cv.calcHist([image_3chanal], [1], None, [256], [0, 256]) r_hist = cv.calcHist([image_3chanal], [2], None, [256], [0, 256]) # 显示3个通道的颜色直方图 plt.plot(b_hist, label='H', color='blue') plt.plot(g_hist, label='S', color='green') plt.plot(r_hist, label='V', color='red') plt.legend(loc='best') plt.xlim([0, 150]) plt.grid() plt.show()
Python OpenCV3 绘制三通道直方图
最新推荐文章于 2024-07-10 09:55:17 发布