Python OpenCV学习笔记之:灰度图像的直方图计算

为什么80%的码农都做不了架构师?>>>   hot3.png

# -*- coding: utf-8 -*-
"""
图像的直方图计算
"""
import cv2 as cv
import matplotlib.pyplot as plt

img = cv.imread("../../../../datas/images/fish.jpg",0)
hist = cv.calcHist([img],[0],None,[256],[0,256])
plt.subplot(121)
plt.imshow(img,'gray')
plt.xticks([])
plt.yticks([])
plt.title("Original")
plt.subplot(122)
plt.hist(img.ravel(),256,[0,256])
plt.show()

转载于:https://my.oschina.net/wujux/blog/801340

你可能感兴趣的:(Python OpenCV学习笔记之:灰度图像的直方图计算)