Grayscale

From Wikipedia, the free encyclopedia

Jump to: navigation, search
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

In computing, a grayscale or greyscale digital image is an image in which the value of each pixel is a single sample. Displayed images of this sort are typically composed of shades of gray, varying from black at the weakest intensity to white at the strongest, though in principle the samples could be displayed as shades of any color, or even coded with various colors for different intensities. Grayscale images are distinct from black-and-white images, which in the context of computer imaging are images with only two colors, black and white; grayscale images have many shades of gray in between. In most contexts other than digital imaging, however, the term "black and white" is used in place of "grayscale"; for example, photography in shades of gray is typically called "black-and-white photography". The term monochromatic in some digital imaging contexts is synonymous with grayscale, and in some contexts synonymous with black-and-white.

Grayscale images are often the result of measuring the intensity of light at each pixel in a single band of the electromagnetic spectrum (e.g. visible light).

Image:4kSnake.png
4096 gray levels
Grayscale images intended for visual display are typically stored with 8 bits per sampled pixel, which allows 256 intensities (i.e., shades of gray) to be recorded, typically on a non-linear scale. The accuracy provided by this format is barely sufficient to avoid visible banding artifacts, but very convenient for programming. Technical uses (e.g. in medical imaging or remote sensing applications) which often require more levels, to make full use of the sensor accuracy (typically 10 or 12 bits per sample) and to guard against roundoff errors in computations. Sixteen bits per sample (65536 levels) appears to be a popular choice for such uses. The PNG image format supports 16 bit grayscale natively, although browsers and many imaging programs tend to ignore the low order 8 bits of each pixel.


Image:Neighborhood watch color.jpg Image:Neighborhood watch grayscale.jpg Image:Neighborhood watch bw.png
The same picture in three different color modes. The picture on the left is the original photograph, in full color. The picture in the center is in grayscale; all the colors contained in it are black, white, or any shade of gray. The picture on the right is in black and white, or monochrome; the only colors used in the picture are black and white, with no intermediary grays.

[edit] Converting color to grayscale

Image:StatueGreyscale.jpg
A Greyscale Statue

To convert any color to its most approximate level of gray, first one must obtain the values of its red, green and blue (RGB) primaries.

Then, add 30% of the red value, 59% of the green value, and 11% of the blue value, together. Regardless of the scale employed (0.0 to 1.0, 0 to 255, 0% to 100%, etc.), the resultant number is the desired gray value, such that a new RGB color would have red, green, and blue values equal to the new number. These percentages are chosen due to the different relative sensitivity of the normal human eye to each of the primary colors (less sensitive to green, more to blue).

This is the method used to obtain the luminance in the YUV and related color models, used in standard color TV and video systems as PAL and NTSC, as well as in the L*a*b color model.

[edit] See also

[edit] External links

es:Escala de grises fr:Niveau de gris ka:ნაცრისფერი ფერის დონე pt:Nível de cinza ru:Серая шкала zh:灰度图像

Views
Personal tools

Toolbox