Histogram matching with OpenCV, scikit-image, and Python

Histogram matching with OpenCV, scikit-image, and Python

Histogram matching with OpenCV, scikit-image, and Python – PyImageSearch

“But what if you wanted to match the contrast or color distribution of two images automatically?

For example, suppose we have an input image and a reference image. Our goal is to:

  1. Compute histograms for each image
  2. Take the reference image histogram
  3. Update the pixel intensity values in the input image using the reference histogram, such that they match

We see the result in the figure at the top of this blog post. Notice how the input image is updated to match the color distribution of the reference image.

Histogram matching is beneficial when applying image processing pipelines to images captured in different lighting conditions, thereby creating a “normalized” representation of images, regardless of the lighting conditions they were captured in (with reasonable expectations set on how much the lighting conditions change, of course)…”

Source: www.pyimagesearch.com/2021/02/08/histogram-matching-with-opencv-scikit-image-and-python/

Subscribe to our Digest