プログラミングの芽

面白そうな技術を使って、楽しいことやりたい

pythonで画像データを見る

参考
OpenCV: Histograms - 1 : Find, Plot, Analyze !!!
前提
pythonによる画像処理 - あたりめ備忘録

plt.hist(img.ravel(),256,[0,256])
plt.show()

>>f:id:atarms:20190128182600p:plain

from scipy import misc

color = ("B", "G", "R")
for channel, col in enumerate(color):
    histr = cv2.calcHist([img], [channel], None, [256], [0, 256])
    plt.plot(histr, color=col)
    plt.xlim([0, 256])
plt.show()

>>f:id:atarms:20190128182524p:plain