1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng Chapter 13: Color Processing
2 © 2010 Cengage Learning Engineering. All Rights Reserved What Is Color? Color study consists of The physical properties of light that give rise to color The nature of the human eye and the ways in which it detects color The nature of the human vision center in the brain and the ways in which messages from the eye are perceived as color Ch13-p.377
3 © 2010 Cengage Learning Engineering. All Rights Reserved What Is Color? Physical Aspects of Color Visible light is part of the electromagnetic spectrum The values for the wavelengths of blue, green, and red were set in 1931 by the CIE (Commission International de l’Eclairage) Ch13-p.377
4 © 2010 Cengage Learning Engineering. All Rights Reserved What Is Color? Perceptual Aspects of Color The human visual system tends to perceive color as being made up of varying amounts of red, green, and blue That is, human vision is particularly sensitive to these colors. This is a function of the cone cells in the retina of the eye Ch13-p.377
5 © 2010 Cengage Learning Engineering. All Rights Reserved What Is Color? Primary colors Red, blue and green Secondary colors Magenta(purple) = red + blue, Cyan = green + blue, Yellow = red + green Ch13-p.378
6 FIGURE 13.1 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.378
7 FIGURE 13.2 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.378
8 © 2010 Cengage Learning Engineering. All Rights Reserved What Is Color? Tristimulus values ( X, Y and Z ) Chromaticity coordinates A color can be specified by x and y alone Ch13-p.380
9 © 2010 Cengage Learning Engineering. All Rights Reserved What Is Color? Ch13-p.380
10 FIGURE 13.3 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.381
Color Models © 2010 Cengage Learning Engineering. All Rights Reserved. A color model is a method for specifying colors in some standard way It generally consists of a three-dimensional coordinate system and a subspace of that system in which each color is represented by a single point Ch13-p.381
Color Models © 2010 Cengage Learning Engineering. All Rights Reserved RGB Note also from Figure 13.1 that some colors require negative values of R,G, or B These colors are not realizable on a computer monitor or TV set on which only positive values are possible The colors corresponding to positive values form the RGB gamut Ch13-p.381
13 FIGURE 13.4 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.382
14 FIGURE 13.5 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.383
Color Models © 2010 Cengage Learning Engineering. All Rights Reserved Hue, Saturation, and Value Hue: The “true color” attribute (red, green, blue, orange, yellow, and so on) Saturation: The amount by which the color has been diluted with white. The more white in the color, the lower the saturation Value: The degree of brightness. A well-lit color has high intensity; a dark color has low intensity Ch13-p.382
16 FIGURE 13.6 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.383
Color Models © 2010 Cengage Learning Engineering. All Rights Reserved Conversion between RGB and HSV Ch13-p.384
Color Models © 2010 Cengage Learning Engineering. All Rights Reserved. HSV RGB Ch13-p.385
Color Models © 2010 Cengage Learning Engineering. All Rights Reserved YIQ This color space is used for TV and video in the United States and other countries where NTSC sets the video standard In this scheme Y is the luminance (this corresponds roughly with intensity) I and Q carry the color information Ch13-p.386
20 Note the difference between Y and V 13.2 Color Models © 2010 Cengage Learning Engineering. All Rights Reserved. Other transformation [7] of the V Ch13-p.386
21 FIGURE 13.7 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.387
Color Images in M ATLAB © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.387
23 FIGURE 13.8 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.388
24 FIGURE 13.9 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.389
Color Images in M ATLAB © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.389
26 FIGURE & © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.389
Pseudocoloring © 2010 Cengage Learning Engineering. All Rights Reserved Intensity Slicing In this method, we break up the image into various gray level ranges. We simply assign a different color to each range. For example Ch13-p.390
28 FIGURE © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.390
Pseudocoloring © 2010 Cengage Learning Engineering. All Rights Reserved Gray to Color Transformations We have three functions, f R (x), f G ( x ), f B ( x ), that assign red, green, and blue values to each gray level x These values (with appropriate scaling, if necessary) are then used for display Using an appropriate set of functions can enhance a grayscale image with impressive results Ch13-p.391
Pseudocoloring © 2010 Cengage Learning Engineering. All Rights Reserved Ch13-p.391
Pseudocoloring © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.391
Pseudocoloring © 2010 Cengage Learning Engineering. All Rights Reserved. The available color maps are listed in the help file for graph3d Ch13-p.392
Pseudocoloring © 2010 Cengage Learning Engineering. All Rights Reserved. Create our own color map Using the RGB values Ch13-p.392
Pseudocoloring © 2010 Cengage Learning Engineering. All Rights Reserved. Create our own color map Before we apply it to the blocks image, we need to scale the image down so that there are only the four grayscales 0, 1, 2, and 3 Ch13-p.392
Processing of Color Images © 2010 Cengage Learning Engineering. All Rights Reserved. There are two methods we can use: We can process each RGB matrix separately We can transform the color space so that the intensity is separated from the color information, and process the intensity component only Ch13-p.393
36 FIGURE © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.393
37 FIGURE © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.393
Processing of Color Images © 2010 Cengage Learning Engineering. All Rights Reserved Contrast Enhancement Contrast enhancement is best done by processing the intensity component Ch13-p.395
Processing of Color Images © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.395
Processing of Color Images © 2010 Cengage Learning Engineering. All Rights Reserved Spatial Filtering The schema we use depends on the filter. For a low- pass filter, say a blurring filter, we can apply the filter to each RGB component Ch13-p.396
41 FIGURE © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.396
Processing of Color Images © 2010 Cengage Learning Engineering. All Rights Reserved Noise Reduction Ch13-p.397
43 FIGURE © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.398
44 FIGURE 3.17 © 2010 Cengage Learning Engineering. All Rights Reserved. Ch13-p.398
Processing of Color Images © 2010 Cengage Learning Engineering. All Rights Reserved Edge Detection We can go about obtaining an edge image in two ways: Take the intensity component only and apply the edge function to it Apply the edge function to each of the RGB components and join the results Ch13-p.399
46 FIGURE © 2010 Cengage Learning Engineering. All Rights Reserved. To implement the first method, we start with the rgb2gray function: Ch13-p.399