Image histograms capture the way a scene is rendered using the available pixel intensity values. By analyzing the distribution of the pixel values over an image, it is possible to use this information to modify and possibly improve an image. This recipe explains how you can use a simple mapping function, represented by a lookup table, to modify the pixel values of an image. As we will see, lookup tables are often defined from histogram distributions.
Applying lookup tables to modify the image's appearance
How to do it...
A lookup table is a simple one-to-one (or many-to-one) function that defines how pixel values are transformed into new values. It is a 1D array with, in the case of regular gray-level images, 256 entries...