Defects and optical aberrations, together with diffraction, contribute to image quality degradation. An efficient way to assess image quality is to calculate contrast, that is the difference in luminance that makes an object - its representation in the image or on a display - distinguishable. Mathematically, contrast is defined as
where Imax (Imin) is the highest (lowest) luminance. In a digital image, ‘luminance’ is a value that goes from 0 (black) to a maximum value depending on color depth (number of bits used to describe the brightness of each color). For typical 8-bit images (in grayscale, for the sake of simplicity), this value is 2^8 -1 = 255, since this is the number of combinations (counting from the zero ‘black’ string) one can achieve with 8 bits sequences, assuming 0-1 values for each.