This site is being phased out.

Contrast

From Mathematics Is A Science
Jump to navigationJump to search
RectangeCounted.JPG

Consider an object in a gray scale image. Its contrast measures how different it is from its background (compare to Wikipedia). Simply put it's the difference between the max gray level and min gray level of the object. More precise definition is below.

Contrast of a dark object 
  = highest gray level adjacent to it - lowest gray level within it 

Contrast of a light object 
  = highest gray level within it - lowest gray level adjacent to it

For example, the intensity of object #12 is 128 and that of the most of #11 is 192. Therefore,

 the contrast of object #11 = 255 - 128 = 127. 
 the contrast of object #12 = 192 - 128 = 64.

The following is a more compact formula:

Contrast = | border's intensity - object's intensity |


The object.
Object-contrast.JPG

Suppose the curve on the left is the gray scale function of the image. Then the tip marked with a horizontal line corresponds to an object. Finally, the height marked in red is the contrast of the object.








The images below show how the number of objects declines as the contrast threshold increases: 0, 30, 50, 70, 125.

Vision test.jpg Vision test 150 0.JPG Vision test 244 30.jpg Vision test 244 50.jpg Vision test 244 70.jpg Vision test 244 125.jpg

Objects start to become visible to the human eye at contrast 5-10.

If we take the average intensity within the object instead of max/min we have the average contrast. The advantage of average contrast is that it is more 'robust'. Adding a single white pixel (salt-and-pepper noise) to a light object may dramatically increase its contrast, but not its average contrast.

The original
Photoshop: Auto Contrast
Pixcavator: contrast at 0 (otherwise nothing is found)










Below a very good segmentation is found without limitations on size.

The original
Pixcavator: size = 0, contrast = 64


Contrast.jpg

Exercise. Analyze the image above.

The contrast is used for filtering objects in Pixcavator (the second slider). To experiment with the concepts, download the free Pixcavator Student Edition.

For other measurements see Measuring objects.


To see how this can be applied, browse our numerous image analysis examples.

On a deeper level, contrast is persistence.