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:
- Compute histograms for each image
- Take the reference image histogram
- 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)…”