1. Home
  2. Docs
  3. Computer Vision
  4. Image Processing Function...
  5. Histogram Equalization

Histogram Equalization

Histogram equalization is a technique in image processing used to improve the contrast of an image by adjusting its histogram.

The goal is to spread out the most frequent intensity values and make the histogram of the image approximately uniform.

This can enhance the contrast of an image, making features more visible.

cv2.calcHist(images, channels, mask, histSize, ranges, accumulate=False)
  • images: The source image(s). It should be provided as a list, e.g., [image].
  • channels: The index of the channel for which the histogram is computed. For grayscale, it’s [0]; for color images, it could be [0] for the blue channel, [1] for the green, and [2] for the red.
  • mask: A mask image (optional). If provided, it should be a binary mask where the histogram will be calculated only for the masked pixels. If you don’t want to use a mask, pass None.
  • histSize: The number of bins in the histogram. For a grayscale image, it’s usually [256] (for 256 intensity levels).
  • ranges: The range of intensity values. For example, [0, 256] for a standard 8-bit image with intensity values between 0 and 255.
  • accumulate: A Boolean flag that indicates whether to accumulate the histogram across multiple function calls. Default is False.

Loading

Views: 1

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments