Sunday, March 14, 2010

Image Processing: Contrast and Brightness

In Computer Graphics, RGB color model is often used to describe an image which means that the appearance of a pixel (often referred as Picture Element) is characterized by three primary bands i.e. Red, Green and Blue. Different kinds of effects with respect to the appearance of the image are created by manipulating the RGB values of pixels of the image. These effects include image blurring, rotation, edge detection, sharpening and different kinds of transformations etc. Image's contrast and brightness are two of those effects related to the appearance the image. There exist other models including HSV, HSI, YCbCr etc which can also be used to create these types of visual effects.
A pixel of a color image is represented by 24 bits (8 bits for each primary band which may assume any value between 0 to 255) in contrast to binary images, grey-scale images etc where the bits to represent the pixel may be less. However, another 8 bits are sometimes added (as is the case with Java) to represent the pixel which stands for alpha value representing transparency (i.e. opacity) of the pixel hence making a total of 32 bits to represent the pixel. There is plenty of information available on the web about different color models and different ways for their representation and manipulation. Here we want describe about an image's contrast and brightness.
The contrast of an image is defined by the distribution of the color values of the pixels of the image i.e. in a high contrast image; the color values of pixels exist over a wide distribution. On the other hand, a low contrast image, they exist in a narrow distribution. Hence color values are grouped together tightly over a short range of value for low contrast and are grouped loosely over a wide range of values for high contrast images. This grouping of color values also has an effect on the appearance of the image called Brightness.


In case of High Contrast Image, image appearance is much detailed while most of the details disappear in case of low contrast image. That's why often contrast enhancement is performed on images to make details visible which cannot be seen in low contrast. Coming back to the location of grouping of color values, the image may appear in some form grey color depending upon the location of grouping. That is if the location of the grouping of the values is (or close to) the maximum extreme (e.g. for RGB model, bands have a value of or near to 255), the image appears to be whitish while if location of grouping is (or close to) the minimum extreme (e.g. for RGB model, bands have a value of or near to 0), the image appears to be blackish. Therefore, this location of grouping of values make image look bright or dark.

Contrast of an image can be increased (or decreased) by increasing (or decreasing) the width of the color distribution. Brightness of an image can be increased by shifting the location of the grouping of values towards the maximum extreme value or can be decreased by shifting the location of grouping towards the minimum extreme value.

Histogram Analysis of an image is an analytic approach for studying images which is graphical representation of the color values occurring in the image, hence a representation of image contrast and brightness. The histogram shows the number of occurrences in an image of all possible values. A technique based on Histogram Analysis is called Histogram Equalization that is used controlling image contrast and brightness. Histogram Equalization can be performed in ways either Global Histogram Equalization (GHE) on the whole of image or Local Histogram Equalization in which case equalization is performed on a section or sections of an image. Generally, equalization is performed on grey-scale images, for color images equalization is performed on each primary band if color model is RGB. However, it is recommended to convert the image into some other color model before applying Histogram Equalization. For further details see following links:
Wikipedia Histogram Equalization
Ruye Wang Histogram Equalization
HIPR2 Histogram Equalization

No comments: