Vous êtes sur la page 1sur 13

EE 576 Machine Vision Lecture Notes

Prof. H. Il Bozma s

Electrical and Electronics Engineering 2009

Contents
4 Color 4.1 Human Perception . . . . . . . . . . . 4.2 Dominant Wavelength . . . . . . . . . 4.3 Tristimulus Theory of Color Perception 4.4 Color Models . . . . . . . . . . . . . . 4.4.1 RGB Model . . . . . . . . . . . 4.4.2 CMY Model . . . . . . . . . . . 4.4.3 HSI Model . . . . . . . . . . . . 4.4.4 YIQ . . . . . . . . . . . . . . . 4.4.5 Comparative Evaluation . . . . 4.5 Light Sources . . . . . . . . . . . . . . 4.5.1 Spectral Content . . . . . . . . 4.5.2 Kelvin Rating . . . . . . . . . . 1 1 2 3 4 4 5 5 7 7 8 8 9

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

ii

List of Figures
4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 Top:Electromagnetic Frequency Spectrum; Bottom: Visible spectrum Pure colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Real colors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Human spectral response. . . . . . . . . . . . . . . . . . . . . . . . . Color wavelength maps . . . . . . . . . . . . . . . . . . . . . . . . . . RGB Cube Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . Left: Color addition with RGB model; Right: Color subtraction with model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CIE Chromaticity Diagram. . . . . . . . . . . . . . . . . . . . . . . . HSI Color space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Kelvin scale. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Spectrum of various type of lights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CMY . . . . . . . . . . . . . . . . . . . . 1 1 2 3 3 4 5 6 7 8 9

iii

Chapter 4 Color
Electromagnetic waves have varying frequency as seen in Fig. 4.1. Sample lights are as shown in Fig. 4.3.

Figure 4.1 Top:Electromagnetic Frequency Spectrum; Bottom: Visible spectrum

Figure 4.2 Pure colors

4.1

Human Perception

The human visual system can distinguish 100 shades of gray, however it has much more discriminating power with respect to color shades. Thus, color provides a lot of information about the current scene which can then be used in image analysis and understanding in particular segmentation. Brightness or luminance is determined by the perception of the color, and is therefore psychological. Given equally intense blue and green, the blue 1

4.2. DOMINANT WAVELENGTH

CHAPTER 4. COLOR

Figure 4.3 Real colors. is perceived as much darker than the green. Note also that our perception of intensity is nonlinear, with changes of normalized intensity from 0.1 to 0.11 and from 0.5 to 0.55 being perceived as equal changes in brightness. Our perception of color is determined by the following factors: 1. Color of the light source (Fig. 4.1) 2. Reectance properties of an object we see those rays that are reected, while others are absorbed. 3. The nature of the visual system (human or robot) The human retina has 3 kinds of cones. The response of each type of cone as a function of the wavelength of the incident light is as shown in Fig. 4.1. The peaks for each curve are at 440nm (blue), 545nm (green) and 580nm (red). In order to understand how these three components interact, consider an object that reects both red and green. It will appear green when there is green but no red light illuminating it. Conversely, if the light is only red (no green light), it will appear red. In white light, it will appear yellow which is combination of red and green. The perception of color is an entirely due to our vision system.

4.2

Dominant Wavelength

1. Dominant wavelength - hue 2. Luminance total power


Bogazii Univ., EE 576 Machine Vision: Lecture Notes c H. Il Bozma s

4.3. TRISTIMULUS THEORY OF COLOR PERCEPTION

CHAPTER 4. COLOR

Figure 4.4 Human spectral response. 3. Saturation purity Luminance L = (D A)B + AW Saturation = (D A)B/L 100 White light: D = A Sat. = 0

Figure 4.5 Color wavelength maps

4.3

Tristimulus Theory of Color Perception

The tristimulus theory of color perception implies that any color can be obtained from a mix of the three primaries red, green and blue. However, although nearly all visible colors can be matched in this way, some cannot. However, if one of the primaries is added to one of these unmatchable colors, it can be matched by a mixture of the other two, and so the color may be considered to have a negative weighting of that particular primary.

Bogazii Univ., EE 576 Machine Vision: Lecture Notes c

H. Il Bozma s

4.4. COLOR MODELS

CHAPTER 4. COLOR

4.4

Color Models

There are several dierent color models: RGB Model CMY Model HSI Model YIQ Model

Figure 4.6 RGB Cube Model.

4.4.1

RGB Model

In the RGB model, an image consists of three independent image planes: red, green and blue. A particular color is specied by given the amount of each primary color as shown in Fig. 4.6. This is an additive model, i.e. the colors present in the light add to form new colors, and is appropriate for the mixing of colored light for example. The image on the left of Fig. ?? shows the additive mixing of red, green and blue primaries: Yellow (red + green) Cyan (blue + green) Magenta (red + blue) White ((red + green + blue) Note that the gray scale spectrum namely those colors made from equal amounts of each primary, lies on the line joining the black and white vertices. The RGB model is used for color monitors and most video cameras.
Bogazii Univ., EE 576 Machine Vision: Lecture Notes c H. Il Bozma s

4.4. COLOR MODELS

CHAPTER 4. COLOR

Figure 4.7 Left: Color addition with RGB model; Right: Color subtraction with CMY model.

4.4.2

CMY Model

The CMY (cyan-magenta-yellow) model is a subtractive model with three primaries: Cyan (C), magenta (M) and yellow (Y). Hence, it is used in cases where absorption of colors is valid. In contrast to RGB model where colors are added to black to get a particular color, CMY model denes what is subtracted from white. If a surface coated with cyan pigment is illuminated by white light, no red light is reected, and similarly for magenta and green, and yellow and blue. The relationship between the RGB and CMY models is given by: C 1R M = 1G (4.0) Y 1B

4.4.3

HSI Model

In 1931, the Commission Internationale de lEclairage (CIE) dened three standard primaries that can be added to form all visible colors: 1. X: 2. Y Chosen so that its color matching function is equal to the luminous-eciency function for the human eye as given by the sum of the three curves. 3. Z: called X, Y and Z, that can be added to form all visible colors. The CIE Chromaticity Diagram shows all visible colors where the axes give the normalized amounts of the X and Y primaries for a particular color, and hence z = 1 x y. The HSI model is motivated by this representation. In this model, a color is represented by three independent quantities: 1. Hue as determined determined by the dominant wavelength. Visible colors occur between about 400nm (violet) and 700nm (red) on the electromagnetic spectrum. 2. Saturation as determined by the excitation purity or equivalently by the amount of white light mixed with the hue. A pure hue is fully saturated, i.e. no white light mixed in. Hue and saturation together determine the chromaticity for a given color.
Bogazii Univ., EE 576 Machine Vision: Lecture Notes c H. Il Bozma s

4.4. COLOR MODELS

CHAPTER 4. COLOR

Figure 4.8 CIE Chromaticity Diagram. 3. Intensity as determined by the actual amount of light. Colors with more light correspond to more intense colors. (a) Achromatic light has no color that is its only attribute is intensity). (b) Gray level is a measure of intensity. (c) The intensity is determined by the energy, and is therefore a physical quantity. Conversion between the RGB model and the HSI model is as follows: 1 I = (R + G + B) 3 (4.0)

where the quantities R, G and B are the amounts of the red, green and blue components, normalized to the range [0; 1]. The intensity is therefore just the average of the red, green and blue components. The saturation is given by: S =1 3 min(R, G, B) =1 min(R, G, B) I R+G+B (4.0)

where the min(R, G, B) term describes the amount of white present. If any of R, G or B are zero, there is no white and we have a pure color. Finally, H = cos1 (
1 ((R 2 G)2

((R

G) + (R B)) ) + (R B)(G B))1

(4.0)

where H [0, ]. Otherwise, H = 2 H.

Bogazii Univ., EE 576 Machine Vision: Lecture Notes c

H. Il Bozma s

4.4. COLOR MODELS

CHAPTER 4. COLOR

Figure 4.9 HSI Color space

4.4.4

YIQ

The YIQ (luminance-in phase-quadrature) model is a recoding of RGB for color television. and is a very important model for color image processing. The conversion from RGB to YIQ is given by: Y 0.299 0.587 0.114 R I = 0.596 0.275 0.321 G (4.0) Q 0.212 0.523 0.311 B The luminance (Y ) component contains all the information required for B/W television. television, and captures our perception of the relative brightness of particular colors. That we perceive green as much lighter than red, and red lighter than blue, is indicated by their respective weights of 0.587, 0.299 and 0.114 in the rst row of the conversion matrix above. These weights should be used when converting a color image to grayscale if you want the perception of brightness to remain the same. This is not the case for the intensity component in an HSI image.

4.4.5

Comparative Evaluation

Given all these dierent representations of color, and hence color images, can we apply the binary image processing techniques here? 1. Apply the transformations to each color plane in an RGB image (a) Equalize each color independently = Lead to dierent colors 2. Apply the transformation to just the intensity component of an HSI image, or the luminance component of a YIQ image = Do not change color

Bogazii Univ., EE 576 Machine Vision: Lecture Notes c

H. Il Bozma s

4.5. LIGHT SOURCES

CHAPTER 4. COLOR

4.5

Light Sources

Measuring color temperature in Kelvin Designating a light sources spectral distribution Kelvin scale Black Body Radiator energy emission. At absolute zero - minus 273.3 Centigrade - this theoretical object radiates no energy. As the temperature of Theoretical Black Body Emits energy. 700 C, a faint red glow becomes visible to the naked eye. At 1517 C, it glows with a light similar to candle or relight (At 1800 K). At 2850 K, a typical household incandescent lamp At 3200 K, a typical studio incandescent lamp At 5600 K, nominal daylight. Blue sky of 28, 000 K

Figure 4.10 Kelvin scale.

4.5.1

Spectral Content

From 1800K to 28, 000K, continuous spectral distribution of the TBB from 300 to 700nm The spectral energy is not interrupted The balance or ratio of red to blue shifts - Kelvin , lights blueness

Bogazii Univ., EE 576 Machine Vision: Lecture Notes c

H. Il Bozma s

4.5. LIGHT SOURCES

CHAPTER 4. COLOR

4.5.2

Kelvin Rating

Kelvin rating Light source that emits energy across the entire visible range Sunlight and incandescent lamps Black Body Simulators Similar to spectral distribution of the Theoretical Black Body Radiator. Measure the energy at two places in the spectrum - red and blue - to determine the Kelvin. Light source with interrupted spectrum (uorescent and discharge lamps) Light source does not have Kelvin temperature. Light sources

Figure 4.11 Spectrum of various type of lights

Bogazii Univ., EE 576 Machine Vision: Lecture Notes c

H. Il Bozma s

Bibliography
[1] Horn, P. Robot Vision. The MIT Press, 1986. [2] Foley, Van Dam, Feiner, Hughes. Computer Graphics: Principles and Practice, Addison Wesley, 1993.

10

Vous aimerez peut-être aussi