Book Image

OpenCV Essentials

Book Image

OpenCV Essentials

Overview of this book

Table of Contents (15 chapters)
OpenCV Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Histogram matching and LUT


The histogram may also be used to modify the color of an image. Histogram matching is a method of color adjustment between two color images. Given a reference image and a target image, the result (destination image) will be equal to the target image except that its (three) histograms will look like those of the reference image. This effect is known as color mapping or color transfer.

The histogram matching algorithm is run over each of the three color histograms independently. For each channel, the cumulative distribution function (cdf) has to be calculated. For a given channel, let Fr be the cdf of the reference image and Ft be the cdf of the target image. Then, for each pixel v in the reference image, we find the gray level w, for which Fr(v)=Ft(w). The pixel with value v is thus changed to w.

Next, we provide another example of histograms in which we use a technique called histogram matching. The example also uses look-up tables (LUT). A look-up table transformation...