Color histogram

Most often, the space is divided into an appropriate number of ranges, often arranged as a regular grid, each containing many similar color values.

The histogram provides a compact summarization of the distribution of data in an image.

[1] By comparing histogram signatures of two images and matching the color content of one image with the other, the color histogram is particularly well suited for the problem of recognizing an object of unknown position and rotation within a scene.

Importantly, translation of an RGB image into the illumination invariant rg-chromaticity space allows the histogram to operate well in varying light levels.

In a more simple way to explain, a histogram is a bar graph, whose X-axis represents the tonal scale(black at the left and white at the right), and Y-axis represents the number of pixels in an image in a certain area of the tonal scale.

For example, the graph of a luminance histogram shows the number of pixels for each brightness level(from black to white), and when there are more pixels, the peak at the certain luminance level is higher.

They show the statistical distribution of colors and the essential tone of an image.

From the definition above, we can simply count the number of pixels for each 256 scales in each of the 3 RGB channel, and plot them on 3 individual bar graphs.

Then, by counting the number of pixels in each of the bins, we get the color histogram of the image.

We can examine clips (spikes on either the black or white side of the scale) in each of the 3 RGB color histograms.

There is not much difference between both figures, all we can see is that the whole image becomes brighter (the contrast for each of the blocks remain the same).

Now, we overexpose the original photo again, this time the luminance scale of each block is increased by 50.

When this happens, we lose the contrast of the last 2 blocks, and thus, we cannot recover the image no matter how we adjust it.

To conclude, when taking photos with a camera that displays histograms, always keep the brightest tone in the image below the largest scale 255 on the histogram in order to avoid losing details.

The main drawback of histograms for classification is that the representation is dependent on the color of the object being studied, ignoring its shape and texture.

Another problem is that color histograms have high sensitivity to noisy interference such as lighting intensity changes and quantization errors.

Some color histogram feature spaces often occupy more than one hundred dimensions.

Although there are drawbacks of using histograms for indexing and classification, using color in a real-time system has several advantages.

It has been shown in some cases that color can be an efficient method for identifying objects of known location and appearance.

Further research into the relationship between color histogram data to the physical properties of the objects in an image has shown they can represent not only object color and illumination but relate to surface roughness and image geometry and provide an improved estimate of illumination and object color.

[6] The idea of an intensity histogram can be generalized to continuous data, say audio signals represented by real functions or images represented by functions with two-dimensional domain.

A picture a cat
A picture of a cat
Color histogram of the above cat picture with x-axis being RGB and y-axis being the frequency.
A picture of a cat that has been reduced to 256 colors
A picture of a cat reduced to 256 colors in the RGB color space