pythonhist图颜⾊_使⽤python中的cv2.calcHist⽬录中多个图
像的颜⾊直⽅图
奥运会英语
上⾯的代码有⼀些⼩的修改,我在test⽂件夹中绘制了两个虚拟图像的直⽅图。在import matplotlib.pyplot as plt
import cv2
import os
暖和的什么images = []
path = "../Mission Begins/test/"
for image in os.listdir(path):
images.append(image)
for image in images:
img = cv2.imread("%s%s"%(path, image)) # Load the image
初中封闭学校
channels = cv2.split(img) # Set the image channels
colors = ("b", "g", "r") # Initialize tuple掩目捕雀
plt.figure()
plt.title("Color Histogram")
plt.xlabel("Bins")
plt.ylabel("Number of Pixels")
for (i, col) in zip(channels, colors): # Loop over the image channels专题摄影
hist = cv2.calcHist([i], [0], None, [256], [0, 256]) # Create a histogram for current channel
vlookup函数应用
plt.plot(hist, color = col) # Plot the histogram
plt.xlim([0, 256])
输⼊图像
领养小猫直⽅图
输⼊图像
石蛙养殖技术
直⽅图