Chapter 6 : Color Image Processing
Total Page:16
File Type:pdf, Size:1020Kb
Chapter 6 : Color Image Processing CCU, Taiwan Wen-Nung Lie Color Fundamentals Spectrum that covers visible colors : 400 ~ 700 nm Three basic quantities Radiance : energy that flows from the light source (measured in Watts) Luminance : a measure of energy an observer perceives from a light source (in lumens) Brightness : a subjective descriptor difficult to measure CCU, Taiwan Wen-Nung Lie 6-1 About human eyes Primary colors for standardization blue : 435.8 nm, green : 546.1 nm, red : 700 nm Not all visible colors can be produced by mixing these three primaries in various intensity proportions Cones in human eyes are divided into three sensing categories 65% are sensitive to red light, 33% sensitive to green light, 2% sensitive to blue (but most sensitive) The R, G, and B colors perceived by CCU, Taiwan human eyes cover a range of spectrum Wen-Nung Lie 6-2 Primary and secondary colors of light and pigments Secondary colors of light magenta (R+B), cyan (G+B), yellow (R+G) R+G+B=white Primary colors of pigments magenta, cyan, and yellow M+C+Y=black CCU, Taiwan Wen-Nung Lie 6-3 Chromaticity Hue + saturation = chromaticity hue : an attribute associated with the dominant wavelength or dominant colors perceived by an observer saturation : relative purity or the amount of white light mixed with a hue (the degree of saturation is inversely proportional to the amount of added white light) Color = brightness + chromaticity Tristimulus values (the amount of R, G, and B needed to form any particular color : X, Y, Z trichromatic coefficients : x = X /(X + Y + Z) y = Y /(X + Y + Z) z = Z /(X + Y + Z) CCU, Taiwan Wen-Nung Lie 6-4 Chromaticity diagram Show color composition as a function of x, y, and z Spectrum colors are indicated around the boundary of the tongue-shaped chromaticity diagram Point of equal energy : equal fractions of three primary colors → CIE defined white light Points located on the boundary of chromaticity diagram are fully saturated -- the saturation at the center point is zero CCU, Taiwan Wen-Nung Lie 6-5 Chromaticity diagram (cont.) A straight line segment joining any two points defines all color variations of the combination of them No three colors in the diagram can span the whole color space -- not all colors can be obtained with three single and fixed primaries The color gamut produced by RGB monitors ⇒ The color printing gamut is irregularly-shaped ⇒ CCU, Taiwan Wen-Nung Lie 6-6 Color models, Color space A color model is a specification of a coordinate system within which each color is represented by a single point Hardware-oriented color models e.g., color monitors and printers RGB, CMY (cyan, magenta, yellow), CMYK (+black) Application-oriented color model HSI (hue, saturation, intensity) CCU, Taiwan Wen-Nung Lie 6-7 RGB color model Each color appears in its primary spectral components of R, G, and B Based on a Cartesian coordinate system (cube) CCU, Taiwan Wen-Nung Lie 6-8 CMY and CMYK color models Useful in color printers and copiers Conversion between RGB and CMY ⎡ C ⎤ ⎡1⎤ ⎡R⎤ ⎢M ⎥ = ⎢1⎥ − ⎢G⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣⎢ Y ⎦⎥ ⎣⎢1⎦⎥ ⎣⎢B⎦⎥ In practice, combining CMY colors produces a muddy-looking black. To produce true black, a forth color, black, is added ⇒ CMYK color model CCU, Taiwan Wen-Nung Lie 6-9 HSI color model RGB, CMY, and similar others are not practical for human interpretation Hue : a color attribute that describes a pure color Saturation : a measure of the degree to which a pure color is diluted by white light Derivation of HSI from RGB color cube All points contained in the plane segment defined by the intensity axis (i.e., from black to white) and one color point on the boundaries of the cube have the same hue CCU, Taiwan Wen-Nung Lie 6-10 HSI color model (cont) The HSI space is represented by a vertical intensity axis, the length (saturation) of a vector from the axis to a color point, and the angle (hue) this vector makes with the red axis The power of HSI color model is to allow independent control over hue, saturation, and intensity CCU, Taiwan Wen-Nung Lie 6-11 Conversion between RGB and HSI From RGB to HSI ⎧θ if B ≤ G ⎧ 1 [(R − G) + (R − B)] ⎫ H = ⎨ −1 2 θ = cos ⎨ 2 1/ 2 ⎬ ⎩360 −θ if B > G ⎩[(R − G) + (R − B)(G − B)] ⎭ 3 1 s =1− [min(R,G, B)] I = (R + G + B) (R + G + B) 3 From HSI to RGB RG sector (0°<H<120°) S cos H B = I(1− S) R = I[1+ ] cos(60o − H ) G = 3I − (R + B) CCU, Taiwan Wen-Nung Lie 6-12 Conversion between RGB and HSI (cont) GB sector (120°<H<240°) H = H −120o R = I(1− S) S cos H G = I[1+ ] B = 3I − (R + G) cos(60o − H ) BR sector (240°<H<360°) H = H − 240o G = I(1− S) S cos H B = I[1+ ] R = 3I − (G + B) cos(60o − H ) CCU, Taiwan Wen-Nung Lie 6-13 HSI ⇔ RGB RGB HSI CCU, Taiwan Wen-Nung Lie 6-14 YUV color model YUV color model has been used in PAL TV systems. The luminance Y can be determined from RGB model as Y = 0.299R + 0.587G + 0.114B The other two chrominance components, U and V, are defined as color difference as U = 0.493(B −Y ) V = 0.877(R −Y ) For Completeness, an expression of YUV in terms of RGB is listed below ⎡Y ⎤ ⎡ 0.299 0.587 0.114 ⎤⎡R⎤ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢U ⎥ = ⎢− 0.147 − 0.289 0.436 ⎥⎢G⎥ CCU, Taiwan ⎣⎢V ⎦⎥ ⎣⎢ 0.615 − 0.515 − 0.100⎦⎥⎣⎢B⎦⎥ Wen-Nung Lie 6-15 YCbCr color model It is noted that U and V may be negative as well. In order to make chrominance components nonnegative, the Y, U and V are shifted to produce the YCbCr model, which is used in the international coding standards JPEG and MPEG ⎡ Y ⎤ ⎡ 0.257 0.504 0.098 ⎤⎡R⎤ ⎡ 16 ⎤ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢Cr⎥ = ⎢ 0.439 − 0.368 − 0.071⎥⎢G⎥ + ⎢128⎥ ⎣⎢Cb⎦⎥ ⎣⎢− 0.148 − 0.291 0.439 ⎦⎥⎣⎢B⎦⎥ ⎣⎢128⎦⎥ The inverse operation R'=1.164(Y −16) +1.596(Cr −128) G'=1.164(Y −16) − 0.813(Cr −128) − 0.392(Cb −128) B'=1.164(Y −16) + 2.017(Cb −128) Reference: B.G. Haskell, A. Puri, A.N. Netravali, Digital Video: An introduction to MPEG-2, Chapman & Hail, 1997 Y.Q. Shi, H. Sun, Image and Video compression for multimedia engineering, CRC press, 1999 CCU, Taiwan Wen-Nung Lie 6-16 Conversion between YUV and YCbCr From YUV to YCbCr ⎡ Y ⎤ ⎡0.860 0 0 ⎤⎡Y ⎤ ⎡ 16 ⎤ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢Cb⎥ = ⎢ 0 1.007 0 ⎥⎢U ⎥ + ⎢128⎥ ⎣⎢Cr⎦⎥ ⎣⎢ 0 0 0.714⎦⎥⎣⎢V ⎦⎥ ⎣⎢128⎦⎥ CCU, Taiwan Wen-Nung Lie 6-17 Gray level to color transformation -- pseudocolor Three independent transformation on the graylevels, i.e., establish a color mapping system for graylevels Some standardized CMSs exist, e.g., ironball for infrared image display If all three transforms are the same --> monchrome CCU, Taiwan Wen-Nung Lie 6-18 Effect of different gray to color transformations CCU, Taiwan Wen-Nung Lie 6-19 Color composition for multi- spectral images Often used in display of multi-spectral satellite images Map three bands out of multi-spectra into RGB for color display RGB = (red, green, blue) RGB = (near IR, green, blue) CCU, Taiwan Wen-Nung Lie 6-20 Full-color image processing Full-color and interpretations of its various color- space components Method 1 Process each component image individually and form a composite processed color image from the individually processed components Method 2 Work with color pixels directly CCU, Taiwan Wen-Nung Lie 6-21 • There is a discontinuity in HSI model where 0° and 360° of hue meet • Hue is undefined for 0 saturation CCU, Taiwan Wen-Nung Lie 6-22 Color transformation Transform a vector in color space to another vector -- color mapping function si = Ti (r1,r2 ,...,rn ), i = 1,2,...,n Transformation on a per-color-component basis si = Ti (ri ), i =1,2,..., n Some operations are better suited to specific models Modify pixel intensity ⇒ HSI is suitable (but the cost for conversion from RGB or CMY to HSI is costly) CCU, Taiwan Wen-Nung Lie 6-23 Saturation should be altered to implement complement Color complements Color circle CCU, Taiwan Approximation only Wen-Nung Lie 6-24 Color slicing Highlighting a specific range of colors in an image ⎧ ⎡ W ⎤ ⎪0.5, if ⎢ rj − a j > ⎥ si = ⎨ ⎣ 2 ⎦ any 1≤ j≤n ⎪ ⎩ ri otherwise n ⎧ 2 2 ⎪0.5, if ∑(rj − a j ) > R0 si = ⎨ j=1 , i =1,2,...n ⎪ ⎩ ri otherwise (a1, a2, …,an) is the prototype or average color CCU, Taiwan Wen-Nung Lie 6-25 Device-independent color model (CIE L*a*b* model) Unlike RGB and CMY which are specific for certain devices (monitors and printers) Characteristics of L*a*b* color model The choice for many color management system (CMS) Being colorimetric Perceptually uniform (color differences are perceived uniformly) Device-independent Encompass the entire visible spectrum and can represent accurately the colors of any display, print, or input device An excellent decoupler of intensity (L*) and color (a* : red minus green, b* : green minus blue), making it useful in both image manipulation and image compression applications CCU, Taiwan Wen-Nung Lie 6-26 CIE L*a*b* model * ⎛ Y ⎞ L =116⋅h⎜ ⎟ −16 ⎝ YW ⎠ 3 ⎡ ⎛ X ⎞ ⎛ Y ⎞⎤ ⎧ q, q > 0.008856 a* = 500 h⎜ ⎟ − h⎜ ⎟ h(q) = ⎨ ⎢ ⎜ ⎟ ⎜ ⎟⎥ ⎩7.787q +16 /116 q ≤ 0.008856 ⎣ ⎝ XW ⎠ ⎝ YW ⎠⎦ * ⎡ ⎛ Y ⎞ ⎛ Z ⎞⎤ b = 200⎢h⎜ ⎟ − h⎜ ⎟⎥ ⎣ ⎝ YW ⎠ ⎝ ZW ⎠⎦ (XW ,YW , ZW ) are reference white tristimulas values and X, Y, and Z are tristimulas values of any color The degree to which the luminance is separated from the color in L*a*b* is greater than in other color models CCU, Taiwan Wen-Nung Lie 6-27 Color image tonal correction Tonal correction to provide a proper key (tone) of an image (just like to correct the brightness of a graytone image) Hue of color is not changed For RGB and CMYK -- map all color components with the same transformation function For HSI – only the intensity component is modified CCU, Taiwan Wen-Nung Lie