Image Processing with CV2

A histogram shows how frequently various color values occur in the image.

cv2.calcHist(images, channels, mask, histSize, ranges)
  • images: the source image of type uint8 or float32
  • channels : the index of channel for which we calculate histogram. For grayscale image, its value is [0] and color image, you can pass [0], [1] or [2] to calculate histogram of blue, green or red channel respectively
  • mask : mask image. To find histogram of full image, it is given as “None”.
  • histSize : this represents our BIN count. For full scale, we pass [256].
  • ranges : Normally, it is [0, 256].

Posted on July 14, 2021 Tags: