color models

13
COMPUTER GRAPHICS ASSIGNMENT NAME : G.MUTHUMANIKANDAN ROLL NO : 70244 COURSE : B.SC.COMPUTER SCIENCE YEAR : III TITLE : COLOR MODELS SUBMITTED TO : Mrs.N.ANURADHA M.Sc,M.Phil SUBMITTED ON : 22 - FEBRUARY - 2010

Upload: james921

Post on 18-Nov-2014

427 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Color Models

COMPUTER GRAPHICS

ASSIGNMENT

NAME : G.MUTHUMANIKANDAN

ROLL NO : 70244

COURSE : B.SC.COMPUTER SCIENCE

YEAR : III

TITLE : COLOR MODELS

SUBMITTED TO : Mrs.N.ANURADHA M.Sc,M.Phil

SUBMITTED ON : 22 - FEBRUARY - 2010

Page 2: Color Models

Color Models

A color model is an mathematical orderly system for creating a whole range of colors from a small set of primary colors. There are two types of color models, those that are subtractive and those that are additive. Additive color models use light to display color while subtractive models use printing inks. Colors perceived in additive models are the result of transmitted light. Colors perceived in subtractive models are the result of reflected light.

Some Important Terms :

Hue - is one of the three main attributes of perceived color, in addition to lightness and chroma (or colorfulness).

Saturation in color theory - the intensity of a specific hue

Luminance -It describes the amount of light that passes through or is emitted from a particular area, and falls within a given solid angle. It is often used to characterize emission or reflection from flat, diffuse surfaces.

Brightness - is an attribute of visual perception in which a source appears to emit or give give out a given amount of light. In other words, brightness is the perception elicited by the luminance of a visual target.

Each color model has is own gamut (range) of colors that can be displayed or printed. Each color model is limited to only a portion of the visible spectrum. Since a color model has a particular range of available color or gamut, it is referred to as using a "color space". An image or vector graphic is said to use either the RGB color space or the CMYK color space (or the color space of another color model). Some graphic applications present the user with more than one color model for image editing or illustration and it is important to choose the right one for the task. The whole point of this article is to explain the difference between the two color models so you choose the right one for the job. For you work to display at its best, choosing the right color model is critical.

The Two Most Common Color Models

There are several established color models used in computer graphics, but the two most common are the RGB model (Red-Green-Blue) for computer display and the CMYK model (Cyan-Magenta-Yellow-blacK) for printing.

RGB Color Model

Additive color modelFor computer displays

Uses light to display color.Colors result from transmitted light

CMYK Color Model

Subtractive color modelFor printed material

Uses ink to display color.Colors result from reflected light

Page 3: Color Models

Red+Green+Blue=White Cyan+Magenta+Yellow=Black

Notice the centers of the two color charts. In the RGB model, the convergence of the three primary additive colors produces white. In the CMYK model, the convergence of the three primary subtractive colors produces black.

In the RGB model notice that the overlapping of additive colors (red, green and blue) results in subtractive colors (cyan, magenta and yellow). In the CMYK model notice that the overlapping of subtractive colors (cyan, magenta and yellow) results in additive colors (red, green and blue).

Also notice that the colors in the RGB model are much brighter than the colors in the CMYK model. It is possible to attain a much larger percentage of the visible spectrum with the RGB model. That is because the RGB model uses transmitted light while the CMYK model uses reflected light. The muted appearance of the CMYK model demonstrates the limitation of printing inks and the nature of reflected light. The colors in this chart appear muted because they are displayed within their printable gamut (see below).

RGB Color Model

The RGB model forms its gamut from the primary additive colors of red, green and blue. When red, green and blue light is combined it forms white. Computers generally display RGB using 24-bit color. In the 24-bit RGB color model there are 256 variations for each of the additive colors of red, green and blue. Therefore there are 16,777,216 possible colors (256 reds x 256 greens x 256 blues) in the 24-bit RGB color model.In the RGB color model, colors are represented by varying intensities of red, green and blue light. The intensity of each of the red, green and blue components are represented on a scale from 0 to 255 with 0 being the least intensity (no light emitted) to 255 (maximum intensity). For example in the above RGB chart the magenta color would be R=255 G=0 B=255. Black would be R=0 G=0 B=0 (a total absence of light).

The RGB color model is additive in the sense that the three light beam are added together, and their light spectra add, wavelength for wavelength, to make the final color's

Page 4: Color Models

spectrum.Zero intensity for each component gives the darkest color (no light, considered the black), and full intensity of each gives a white; the quality of this white depends on the nature of the primary light sources, but if they are properly balanced, the result is a neutral white matching the system'swhite point. When the intensities for all the components are the same, the result is a shade of gray, darker or lighter depending on the intensity. When the intensities are different, the result is a colorized hue, more or less saturated depending on the difference of the strongest and weakest of the intensities of the primary colors employed. When one of the components has the strongest intensity, the color is a hue near this primary color (reddish, greenish, or bluish), and when two components have the same strongest intensity, then the color is a hue of a secondary color (a shade of cyan, magenta, or yellow). A secondary color is formed by the sum of two primary colors of equal intensity: cyan is green+blue, magenta is red+blue, and yellow is red+green. Every secondary color is the complement of one primary color; when a primary and its complementary secondary color are added together, the result is white: cyan complements red, magenta complements green, and yellow complements blue. To see how different RGB components combine together, here is a selected repertoire of colors and their respective relative intensities for each of the red, green, and blue components. Every slider ranges from 0 to 255.

A color in the RGB color model is described by indicating how much of each of the red, green, and blue is included. The color is expressed as an RGB triplet (r,g,b), each component of which can vary from zero to a defined maximum value. If all the components are at zero the result is black; if all are at maximum, the result is the brightest representable white.

These ranges may be quantified in several different ways:

From 0 to 1, with any fractional value in between. This representation is used in

theoretical analyses, and in systems that use floating point representations.

Each color component value can also be written as a percentage, from 0% to 100%.

In computing, the component values are often stored as integer numbers in the range 0 to

255, the range that a single 8-bit byte can offer (by encoding 256 distinct values).

High-end digital image equipment can deal with the integer range 0 to 65,535 for each primary

color, by employing 16 bit words instead of 8-bit bytes.

Notation RGB triplet

Arithmetic (1.0, 0.0, 0.0)

Percentage (100%, 0%, 0%)

Digital 8-bit per channel (255, 0, 0)

Digital 16-bit per channel (65535, 0, 0)

Page 5: Color Models

The RGB color model mapped to a cube. The horizontal x-axis as red values increasing to the left, y-axis as blue increasing to the lower right and the vertical z-axis as green increasing towards the top. The origin, black, is hidden behind the cube. All colors are obtained by combining these three colors. This model can be thought as a cube, where 3 non-adjacent and perpendicular corners are R, G and B, like in the following figure:

RGB Color Space. The colors with a P are the primary colors. The dashed line indicates where to find the grays, going from (0,0,0) to (255,255,255).

As can be seen, RGB is an additive color model, since the combination of green, red and blue gives white. This is the color model that is most commonly used in computer graphics, since it matches the way the color is stored in video memory.

CMYK Color Model

CMYK (short for cyan, magenta, yellow, and key (black), is a subtractive color model, used in color printing, also used to describe the printing process itself. Though it varies by print house, press operator, press manufacturer and press run, ink is typically applied in the order of the abbreviation.

The CMYK model works by partially or entirely masking certain colors on the typically white background (that is, absorbing particular wavelengths of light). Such a model is called subtractive because inks “subtract” brightness from white.

The CMYK printing method is also known as "four-color process". All of the colors in the printable portion of the color spectrum can be achieved by overlapping "tints" of cyan, magenta, yellow and black inks. A tint is a screen of tiny dots appearing as a percentage of a solid color.

Page 6: Color Models

When various tints of the four colors are printed in overlapping patterns it gives the illusion of continuous tones - like a photograph:

In the CMYK color model, colors are represented as percentages of cyan, magenta, yellow and black. For example in the above CMYK chart the red color is composed of 14% cyan, 100% magenta, 99% yellow and 3% black. White would be 0% cyan, 0% magenta, 0% yellow .It is the substractive counterpart of RGB. If you look at the RGB color model, you will notice that if you take out the primary colors and the white and black (which are not colors), you get the CYM triple. RGB and CYM are complementary; what is a secondary color in RGB is a primary color in CYM.

Due to this, transforming from RGB to CYM and back is very simple:

This color model is used in the printing industry with a variation known as CYMK (Cyan-Magenta-Yellow-Black). This is due to the fact that is very difficult (and expensive) to obtain a pure black combining cyan, yellow and magenta pigments, so a black pigment is added. It is important to choose the right color model for the job. The main purpose of the RGB color model is for the sensing, representation, and display of images in electronic systems, such as televisions and computers though it has also been used in conventional photography. If your images will be printed, then convert them to CMYK and manually bring them into gamut before printing. If your images are to be displayed on a computer, then make sure you use RGB color so the full gamut will be available for display. Because both models can be available at the same time while using an application, it is easy to make a mistake and choose the wrong palette or set of color swatches. One can retain out-of-gamut areas in CMYK images and leave it to the computer to bring the colors into gamut at printing time. However this requires the computer to make the conversion from RGB to CMYK and this doesn't always work out as well as one might expect. Conversion between color models is not always a good idea.

Page 7: Color Models

Because of this fact, you want to scan or shoot images using the appropriate color model for their primary purpose. If the images will be used primarily for print then use CMYK. If they will be used primarily for screen displays, then use RGB. You can always convert from RGB to CMYK but it is best not to.

If you can afford the time, money and disk space to scan or shoot both versions of an image where both are needed, then this is the best solution. This is especially true if you will be using the same images for both printed material and the web. A little planning can go a long way here.

HSV, and HLS Color Models

The HLS (hue, lightness, saturation) and HSV (hue, saturation, value) color models were developed to be more “intuitive” in manipulating with color and were designed to approximate the way humans perceive and interpret color.

Hue defines the color itself. The values for the hue axis vary from 0 to 360 beginning and ending with red and running through green, blue and all intermediary colors.

Saturation indicates the degree to which the hue differs from a neutral gray. The values run from 0, which means no color saturation, to 1, which is the fullest saturation of a given hue at a given illumination.

Intensity component - lightness (HLS) or value (HSV), indicates the illumination level. Both vary from 0 (black, no light) to 1 (white, full illumination). The difference between the two is that maximum saturation of hue (S=1) is at value V=1 (full illumination) in the HSV color model, and at lightness L=0.5 in the HLS color model.

The HSV color space is essentially a cylinder, but usually it is represented as a cone or hexagonal cone (hexcone) as shown in the Figure "HSV Solid", because the hexcone defines the subset of the HSV space with valid RGB values. The value V is the vertical axis, and the vertex V=0 corresponds to black color. Similarly, a color solid, or 3D-representation, of the HLS model is a double hexcone with lightness as the axis, and the vertex of the second hexcone corresponding to white. Both color models have intensity component decoupled from the color information. The HSV color space yields a greater dynamic range of saturation. Conversions from RGBToHSV/RGBToHSV and vice-versa in Intel IPP are performed in accordance with the respective pseudocode algorithms given in the descriptions of corresponding conversion functions.

HSV Color Model

The HSV Color Model stands for the Hue, Saturation, and Value based on the artists (Tint, Shade, and Tone).

The coordinate system in a hexacone

Page 8: Color Models

Here is a view of the HSV color model from the side. The axis has been rotated 180 degrees so that the magenta is pointing to the left.

HLS Color Model

The HLS color model stands for hue, lightness and saturation

Here is a cross section view of the HLS Color model.

Page 9: Color Models

YUV Color Model

The YUV color model is the basic color model used in analogue color TV broadcasting. Initially YUV is the re-coding of RGB for transmission efficiency (minimizing bandwidth) and for downward compatibility with black-and white television. The YUV color space is “derived” from the RGB space. It comprises the luminance (Y) and two color difference (U, V) components. The luminance can be computed as a weighted sum of red, green and blue components; the color difference, or chrominance, components are formed by subtracting luminance from blue and from red.

The principal advantage of the YUV model in image processing is decoupling of luminance and color information. The importance of this decoupling is that the luminance component of an image can be processed without affecting its color component. For example, the histogram equalization of the color image in the YUV format may be performed simply by applying histogram equalization to its Y component.

There are many combinations of YUV values from nominal ranges that result in invalid RGB values, because the possible RGB colors occupy only part of the YUV space limited by these ranges. Figure "RGB Colors Cube in the YUV Color Space" shows the valid color block in the YUV space that corresponds to the RGB color cube RGB values are normalized to [0..1]).

The Y’U’V’ notation means that the components are derived from gamma-corrected R’G’B’. Weighted sum of these non-linear components forms a signal representative of luminance that is called luma Y’. (Luma is often loosely referred to as luminance, so you need to be careful to determine whether a particular author assigns a linear or non-linear interpretation to the term luminance).

The Intel IPP functions use the following basic equation to convert between gamma-corrected R’G’B’ and Y’U’V’ models:

Y'= 0.299*R' + 0.587*G' + 0.114*B'

U'= -0.147*R' - 0.289*G' + 0.436*B' = 0.492*(B'- Y')

V'= 0.615*R' - 0.515*G' - 0.100*B' = 0.877*(R'- Y')

R' = Y' + 1.140*V'

G' = Y' - 0.394*U' - 0.581*V'

B' = Y' + 2.032*U'

Page 10: Color Models

RGB Colors Cube in the YUV Color Space

There are several YUV sampling formats such as 4:4:4, 4:2:2, and 4:2:0 that are supported by the Intel IPP color conversion functions and are described in Image Down sampling.