Digital Image Processing 16 November 2006 Dr. ir. Aleksandra Pizurica Prof. Dr. Ir. Wilfried Philips Aleksandra.Pizurica @telin.ugent.be Tel: 09/264.3415 UNIVERSITEIT GENT Telecommunicatie en Informatieverwerking Colors and their synthesis
Color Fundamentals Isac Newton discovered in 1666 that when a sunlight passes through an optical prism the emerging beam is composed of a continuous spectrum ranging from red to violet GAMMA X-Rays U-V INFRA- RED MICRO- WAVES RADIO ultraviolet visible spectrum infrared 300 400 500 600 700 1000 wavelength [nm] 02b.3 Remainder: Color Metamerism Spectrum of a white color 400 500 600 700 Metamers: light sources of different spectral characteristics but of the same color impression 400 500 600 700 A well chosen mixture of three monochromatic sources is perceived as a light of the same white color 02b.4
CIE primary colors CIE B CIE G CIE R 400 500 600 700 wavelength [nm] Due to these absorption characteristics of the human eye, colors are seen as variable combinations of the so-called PRIMARY COLORS: red (R), green (G) and blue (B) CIE (Commission Internationale de l Eclairage The International Commision on Illumination) established in 1931 the following primars: B=435.8 nm G=546.1nm R=700nm 02b.5 Additive color mixing Superposition of primary colors Typically in TV monitors R, G, B primary colors C, M, Y secondary colors Output signals from the eye cones: RI R ( f ) GI G ( f ) BI B ( f ) r = S ( f ) I ( f df i i ) (before log ) ( ) r = S ( 1 1 f ) RI R ( f ) + GIG ( f ) + BI B ( f ) df r2 = S2( f )( RI R ( f ) + GIG ( f ) + BI B( f )) df r = S ( 3 3 f )( RI R ( f ) + GIG ( f ) + BI B ( f )) df I R (f), I G (f)en I B (f) spectra of the primary colors 02b.6
Subtractive color mixing c m m y c y S c C I( f ) = m ( f ) S ( f ) W( f ) M Output spectrum: I( f ) = I( f ) = m y SM ( f ) SY ( f ) W( f ) c y SC( f ) SY ( f ) W( f ) c m y I( f ) = S ( f ) S ( f ) S ( f ) W( f ) C M Y filters (white) light source In subtractive color mixing, color pigments filter out a part of the white light cyan filter: passes green and blue, absorbs red magenta filter: passes red and blue, absorbs green yellow filter: passes green and red, absorbs blue Multiplicative process: de transmission spectra are (frequency dependent) attenuation factors that are multiplied De attenuation increases with the depth of c, m en y ink layers 02b.7 Color synthesis: summary Additive color mixing: Creating colors by superposition of light source Spectrum is the sum of the spectra of the light sources Example: TV-monitors Subtractive color mixing: Creating colors by filtering out parts of the white light spectrum using successive filters Multiplicative process (the resulting light spectrum is the product of the transmission spectra of the filters (and the spectrum of the white light) Examples: photography, printing Remarks: Typical printing procedures are hybrid (subtractive/additive) and use additional inks (e.g., black CMYK system) 02b.8
The color correction functions Experiment: δ ( f f ) 0 Monochromatic source RI R ( f ) GI G ( f ) BI B ( f ) 1. Adjust R, G, B to produce the same color impression 2. Define: r( f 0 )=R, g( f 0 )=G, b( f 0 )=B 3. Repeat for other f 0 r( f ), g( f ) en b( f ) are color correction functions the values of R, G, en B needed to reproduce the color of spectral (mono-chromatic) light with frequency f These values depend on I R (f), I G (f)en I B (f) Importance: using color correction functions we can determine the amount of primars R, G, en B needed to match the color of arbitrary light source of spectrum I( f ): r( f ) I( f ) df G = g( f ) I( f ) df B = R = b( f ) I( f ) df 02b.9 Gamut problem with CIE-RGB-primars Color correction funtions for RGB 0.4 b(λ) r(λ) 0.2 g(λ) Problem: some colors cannot be reproduced Example: using CIE RGB-primars we cannot match the spectral source with λ=500 nm Reason: in order to cause the necessary cone signals we would need R = -0.09, G = 0.09, en B= 0.05 but the negative light intensity cannot be produced 0.0 400 436 nm 500 546 nm 600 700 nm wavelength λ 700 nm The colors that can be reproduced with a given set of primars form the so-called GAMUT 02b.10
The XYZ-color space The CIE defined color correction functions x( f ), y( f ) en z( f ) that comply with the following requirements: Can be realized as optical filters x( f ), y( f ) en z( f ) positive for all f For uniform white light: X=Y=Z x ( f ) df = y( f ) df = z( f ) df Sources with the same Y are perceived by human eye as equally bright Y is a luminance measure 2 z(λ) = z( c/ λ) 1.5 y(λ) = y( c/ λ) 1 x(λ) = x( c/ λ) 0.5 0 380 460 540 620 700 wavelength [nm] XYZ-coördinaten van een bron I(f) X = x( f ) I( f ) df Y = y( f ) I( f ) df Z = z( f ) I( f ) df 02b.11 The CIE-luminance Y = y f ) I( f ) df ( is called CIE-luminantie Remarks: from the requirements it follows automatically that y( f ) is proportional to spectral sensitivity S 2 (f)of the luminance -cones (those that are sensitivetoyellowgreen tored) log( Y ) is proportionl with the perceived brightness I 02b.12
De xyz-kleurencoördinaten xyz-chromaticity coordinates, are defined to be independent of the intensity: x = X /( X + Y + Z) y = Y /( X + Y + Z) z = Z /( X + Y + Z) x + y + z =1! % groen y 0.8 0.6 0.4 0.2 spectrale (monochromatische) kleuren 660 nm 500 nm HDTV groen X=Y=Z HDTV rood 700 nm HDTV wit Gamut van HDTV 0 HDTV blauw 0 0.2 400 nm 0.4 x 0.6 0.8 % rood 02b.13 The xy-color triangle Gamut color monitor Gamut CMYK-printer Pantone colors Remarks In printing techniques additional inks are used to increase gamut (pantone, goud, ) The spectral colors are on the border. The colors in this figure are not entirely correct! 02b.14
Color tone and saturation (HSV-space) If the brightness is constant Y the color impression is fully determined by chromatic components x and y Definitions Value: Brightness: Y Hue: Color tone: θ Saturation: r (distance to white ) y 0.8 0.6 0.4 0.2 r θ 0 0 0.2 0.4 0.6 0.8 x 02b.15 Adapting saturation original 0.8 y 0.6 color X=Y=Z The-saturation 0.4 well saturated 0.2 0 0 0.2 0.4 0.6 0.8 x 02b.16
Adapting saturation original 0.8 y 0.6 color X=Y=Z Saturation 0.4 100% saturated 0.2 0 0 0.2 0.4 0.6 0.8 x 02b.17 Adapting color tone 0.8 original adapting color tone y 0.6 0.4 color X=Y=Z 0.2 red cyan 0 0 0.2 0.4 0.6 0.8 x Color tone adaptation corresponds to a rotation 02b.18
The MacAdam-ellipses 0.8 0.6 500 nm 540 nm MacAdam-ellipses: colors within these elipses cannot be discriminated y 0.4 600 nm Remark: the actual elipses are much smaller! 0.2 460 nm 0.2 0.4 0.6 x The xy space is non-uniform. The distance in this space does not correspond with the color differences 02b.19 The L a b color space The L a b -space is much more uniform: L = 25 a b = 500 = 200 1/3 ( 100Y / Y0 ) 16 1/3 ( X / X0) ( Y / Y0 ) 1/3 ( X / X ) ( Z / Z ) 1/3 ( ) 1/3 ( ) 0 0 X 0, Y 0 en Z 0 are the XYZ coordinates of a well-defined white light Approximate formula s! Spectral filter x(f) X 1/3 + ( ) Σ 1/3 1/ 3 ( X / X ) ( Y / ) a ~ 0 Y0 Spectral filter y(f) Y 1/3 ( ) + - 1/ 3 ( Y / ) L ~ Y0 cfr.: luminance log(y) Spectral filter z(f) Z 1/3 ( ) - Σ 1/3 1/ 3 ( X / X ) ( Z / ) b ~ 0 Z0 02b.20
... The L a b color space... positive L b positive =yellow negative =green a positive =red zero negative= blue 02b.21...... The L a b color space... De L a b -space is perceptually uniform: In the L a b -space the MacAdams-ellipses are circles Perceptual difference between two sources: Difference in intensity: Color difference: L 2 2 ( L ) + ( a ) + ( b ) 2 2 ( a ) + ( b ) 2 The least perceivable difference in luminance is always L 1 02b.22
Monitors and gamma s r ' s g ' ( s ) γ r ' ( s ) γ g ' s b ' ( s ) γ b ' For cathode ray tube monitors intensity to voltage response curve is roughly a 2.5 power function. Monitors, then, are said to have a gamma of 2.5 This means that if the monitor receives a signal that a certain pixel should have intensity equal to x, it will actually display a pixel which has intensity equal to x 2.5 Because the range of voltages x sent to the monitor is between 0 and 1, this means that the intensity value displayed will be less than wanted 02b.23 Gamma-correction I( f ) camera s = R s r g = G s = B b 1/ γ (.) camera output s ' = R r s ' = B 1/ γ 1/ γ s ' = G g b 1/ γ monitor RI ( f ) r + GI ( f ) g + BI ( f ) b In order to correctly display the image at the monitor, the input signal to the monitor (the voltage) must be "gamma corrected". Since we know the relationship between the voltage sent to the monitor and the intensity which it produces, we can correct the signal before it gets to the monitor. 02b.24
The YUV-kleurenruimte In black-white TV γ -correction was applied to the intensity signal L I(f) black-white camera L L = Sl ( f ) I( f ) df ar + bg+ cb 1/γ (.) L ' = L ( ar+ bg cb) 1/ γ L ' ~ + In a color system γ -correction is applied separately to R, G en B: In order to keep some compatibility with black-white TV now color TV systems send a lluminance signal Y that is a rough approximation for L 1/γ black-white monitor LI L ( f ) R G B 1/γ (.) R G B matrix Y' = 0.299R' + 0.587G' + 0.114B' U' = ( B' Y ')/1.772 V' = ( R' Y ')/1.402 broadcasted signals Y L : the reproduction of intensity on black-white TV is not exact 02b.25 Pseudo color images In pseudo color imaging we assign a color to a particular intensity or range of intensities in a gray-scale (monochrome) image 2002 R. C. Gonzalez & R. E. Woods 02b.26
Pseudo color images 2002 R. C. Gonzalez & R. E. Woods 02b.27 Pseudo color images 2002 R. C. Gonzalez & R. E. Woods 02b.28
Digitalisation of greyvalues and color camera γ-corr. ADC DAC monitor R, G, B R', G', B' r, g, b R ~ ', G ~ ', B ~ ' Quantisation causes errors The perceptual error (measured in Lab space) is not equally big in all positions of the color space the maximal perceptual error has to be sdmall enough this determins the required bitlength for ADC and DAC 8 bit accuracy is enough for quantisation of γ-corrected signals Quantisation of R,G,B requires a higher accuracy (10 to 12 bit) L, a, b Remarks: If the images still need to be processed more bits are needed (e.g. 10 to 12 bits for medical images) The minimal bit length (for a given worst-case perceptual error) is obtained by digitazing in the L a b -color space 02b.29 Color quantisation
Color quantisation : example Ware-kleur 2 kleuren 4 kleuren 8 kleuren 64 kleuren 02b.31 Conclusions for image processing Different reproduction systems have different gamuts Realization of all possible colors is never achievable Digital images are gamma corrected The pixel values are hence R G B -values and not RGB-values Usually the accent is not written Such images are well displayed on a monitor, but without countercompensation not on a LCD-display The colors and intensities have to be evaluated in a perceptually uniform color space De L a b -space is ideal for this However, often used is a representation like 2 a( R') + b( G') + c( B') 2 2 02b.32