Fundamentals of Imaging Colour Spaces
Prof. Dr. Charles A. Wüthrich, Fakultät Medien, Medieninformatik Bauhaus-Universität Weimar caw AT medien.uni-weimar.de Today’s lesson
• All about colour spaces…. • All flavours, all species, all types
May 17 Charles A. Wüthrich 2 Alternative colour spaces
• In general, the XYZ colour – Efficient encoding: some space is not suitable for colour spaces were computing colours or developed for efficient encoding colours. encoding and transmission • Many XYZ pairs do not (NTSC, PAL) match viewable colours – Perceptual uniformity: make • In most cases, alternative the colour space so that colour spaces are used colour distances are • Reasons for alternate colour perceptually sound spaces: – Intuitive usage: RGB is – Physical constraints: I/O device oriented, and far devices have different from being easy to use characteristics, and one might want to couple these to process colour directly
May 17 Charles A. Wüthrich 3 Transforming colour spaces
• Typically, the colour spaces – For simple, linear, additive are characterized by their trichromatic displays the bounding volumes in colour transformation from XYZ to space their colour values can be – Called gamut of colours the usually given by a 3x3 space can represent matrix – They usually do not cover – This due to Grassman’s law all colours: for example, – Conversion is usually done CRT screens can only add with the phospor colours. • a linear transformation to • Gamut mapping: converting XYZ one gamut to another • some non-linear processing to minimize perceptual errors (e.g. gamma correction)
May 17 Charles A. Wüthrich 4 Transforming colour spaces
White point • To convert, one must know – Device primary colours – White point of the device • These are usually described in x,y chromaticity coordinates. • On the device, the primary colours are usually represented as points between 0 and 1 in 3D space (1,0,0), (0,1,0) (0,0,1). • Why do I need the white point? – Simple: remember the CIE coordinates were projections. – So they do not contain luminance! – So we have no idea of their mutual strength – BUT if one knows the white point on the CIE, one knows the proportions of luminances (and know (1,1,1)) – Table shows an example: ITU-R BT 709 colour space (HDTV)
May 17 Charles A. Wüthrich 5 Transforming colour spaces
• Now, if one on top of this knows • The problem is that often the the luminance of the white point, luminance of white is not one knows it all. known, but the CIE chromaticity • If we know the xy coordinates of coordinates the points RGB we can compute z=1-x-y • In this case, one adds up the luminances of the single • Thus, we can have the XYZ of phosphor components (if one RGB: (xR,yR,zR), (xG,yG,zG) , (x ,y ,z ), has it) to obtain the white light B B B one. • …and of the white: (xW,yW,zW). • Which gives following equations
where the Sx are scaling factors and unknown. • This gives:
May 17 Charles A. Wüthrich 6 sRGB colour space
• On a typical display, such as • …and the following linearization CRT, plasma, LED and DLP, transformation, which minimizes the phosphors are RGB. quantization errors in digital • Since they may be different, the applications: basic colors are in general different
• Therefore, there is no such
thing as an RGB space: they
are device dependent! • You have therefore to convert to a standardized set of primaries. this is called gamma encoding • The space sRGB is exactly this • This is NOT gamma correction! standardization: It can be parametrized as: – It assumes luminance as 80cd/ m2 – It uses a matrix computation
May 17 Charles A. Wüthrich 7 RGB Colour spaces
• In the course of time many standards have been developed, depending on their application: – Print – Screen – Draw – Net
May 17 Charles A. Wüthrich 8 RGB Colour spaces
• Here the corresponding colour space gamuts:
May 17 Charles A. Wüthrich 9 RGB Colour spaces
• Converting
modifies colours:
Adobe RGB RGB Adobe
sRGB (original) (original) sRGB
PAL
NTSC NTSC SMPTE-C SMPTE-C
May 17 Charles A. Wüthrich 10 CMY and CMYK
• CMY and CMYK are used for • Here, printers: C=1-R – Cyan M=1-G – Magenta Y=1-B. – Yellow • If one has K, then • These are subtractive colours: printers deposit pigments K=Min(C,M,Y) subctracting light. C=1-R • Inherently device dependent: ink M=1-G has pigments Y=1-B. • Usually, K (=black) is added, because C+Y+M is never real black • Modern printers use many more primary colours, but we focus on 4 colour ones
May 17 Charles A. Wüthrich 11 Luminance-Chrominance
• RGB is useful especially for hardware devices and transmission efficiency
• For intuition, it is easier to work with
Factor 2 2 Factor 2 Factor – one luminance channel – Two chrominance channels • Luminance represents how light or dark
(similar to Y channel) Factor 4 4 Factor – Note that this can be used at the same 4 Factor tome for B/W transmission • Chrominance determine chromatic content
• Similar to visual system: Factor 8 8 Factor
– Rods sense luminance 8 Factor RGB subsampling subsampling RGB – Cones sample colour, in two colour- subsampling Chrominance opposing axes: • Reddish-greenish
• Blueish-yellowish Factor 16 16 Factor – Because of this, colour spatial resolution 16 Factor (pixel) is only on the area of 4 cones – It is therefore possible to transmit colour at a lower resolution without a major quality
decrease
Factor 32 32 Factor 32 Factor
May 17 Charles A. Wüthrich 12 CIE Yxy and YUV
• The CIE Yxy can be seen as a • CIE corrected later to improve uniformity colour space itself into the CIE Yu’v’ space:
– Y carries luminance – Although xy do not match the eye sensors (color wise), nor do
they map perceptual distances nice about these spaces: since they are well defined from Yxy, they are device • As an alternative, the Cie independent proposed the space YUV: – Keep the Y of XYZ and Yxy – Map the other two coordinates so they are uniform:
May 17 Charles A. Wüthrich 13 Broadcasting
• For broadcasting, luminance- • Here, a:b:c means: chrominance systems are well – a: luminance sampling WRT a suited sampling rate of 3.375 MHz – b: chrominance horizontal factor • Chrominance can be with respect to a subsampled, as seen a few – c: either the same as b, or 0 when slides ago the vertical resolution is subsampled at a factor of 2 • Typical subsamplings are done caveat! CONSTANT 2! for both chroma components: • So 4:2:2 means – luminance sampled at 13.5 MHz, – horizontal chrominance subsampled at factor 2, – vertical not subsampled
May 17 Charles A. Wüthrich 14 Broadcast colour spaces: PAL and NTSC
• We saw that broadcasting • NTSC uses instead the Y’I’Q’ converts the RGB signal into a coordinates, defined as composite one for analog broadcasting
• In PAL, we saw before how – I’ is orange-blue R’G’B’ is obtained from XYZ. – Q’: purple-green • From this, the luminance Y’ is • They lead to the transformation subtracted from R’ and B’ to obtain the chroma components
• Quite recently, these standards this leads to the following have been replaced by SMPTE-C transforms for the transmission and the HDTV standards variables Y’U’V’: – similar transformation matrices – not yet stable (see HD+)
May 17 Charles A. Wüthrich 15 HSL space
• Until now we introduced colour • Perpendicular to the lightness axis spaces defined for the hardware or is a circular plane which defines transmission. color • Their main flaw is usability, since it – Saturation: distance of the point on is difficult to understand how their the circular plane to the lightness variables work axis – Hue: angle between predetermined • A space that overcomes this is the reference colour and colour we are Hue, Saturation and Lightness interested in. space (HSL) • HSL comes in a few variants: – HIS (intensity) – HSV (value) • These spaces are defined on the basis of an abstract RGB space which is supposed to be normalized L • Rotate RGB so that the diagonal forms the lightness axis
May 17 Charles A. Wüthrich 16 HSI and HSV spaces
• For HSI: by using the intermediate • For HSV, the minimum and variables maximum of the RGB triplets are computed:
Then HSV are derived: we obtain
• Notice that H is in angle degrees, and that when R=G=B we have a gray value, and H is undefined.
May 17 Charles A. Wüthrich 17 LMS cone excitation space
• Although the CIE XYZ functions are • Remember: closely related to a linear transform – L=long wavelength, of the LMS cone signals, they are – M=middle wavelength not exact, and an approximation is – S=short wavelength needed • Conversion from XYZ to LMS is • A widely used approximation is the simply given through the transforms: Hunt-Pointer-Estevez cone fundamentals, which are used in colour appearance models
the inverse of which is
May 17 Charles A. Wüthrich 18 Colour opponent spaces
• Characterized through • This perceptual uniformity is useful – One achromatic variable because it allows to compute colour – Two channels representing colour differences by simply computing opponency Euclidean distance in the space – Usually red-green opponency+blue- • Finally, we will introduce the Lαβ yellow opponency space • We will examine two of these • This last space was designed by spaces: applying principal component – CIE L*a*b* (CIELAB) analysis to a set of pictures, – CIE L*u*v* (CIELUV) encoded first in the LMS space – Both standardized in 1976 • These spaces are interesting because they use a non-linear compression to achieve perceptual uniformity
May 17 Charles A. Wüthrich 19 CIE 1976 L*a*b*
• Input to CIE L*a*b* are • The inverse is – (X,Y,Z), the stimulus tristimulus values – Tristimulus values of a diffuse white reflecting surface lit by a known illuminant (Xn,Yn,Zn) • Equations calculate – the lightness L* of a colour – Two opponent chromatic channels, a* and b*
• What is interesting of CIELAB is that it is almost perceptually linear, so where the function f is defined as one can compute Euclidean distances between colours: E=Empfindung
May 17 Charles A. Wüthrich 20 CIE 1976 L*u*v*
• Input to CIE L*u*v* are like CIELAB: • Also CIELUV is perceptually more – (X,Y,Z), the stimulus tristimulus or less linear, which means that one values can calculate distances – Tristimulus values of a diffuse white reflecting surface lit by a known illuminant (Xn,Yn,Zn) • Here where the Δ represent differences in the respective components
where
May 17 Charles A. Wüthrich 21 Colour metrics example: E*ab
Lossless: PPM Compressed: JPG
Difference Eab: CIELAB works well on small differences
May 17 Charles A. Wüthrich 22 Lαβ space
• For Lαβ, a set of natural images was used • Then converted into LMS space • And finally principal component analysis was done: rotating the data so that the first component captures most of the variance • Then axes are rotated to coincide with first principal component • Same is done for – 2nd principal component – 3rd principal component • What results is a 3x3 transformation matrix • In the first axis, one has luminance • Second and third axes are yellow- blue and red-green components
May 17 Charles A. Wüthrich 23 L*C*hab space
• This space can be seen as CIELAB • Colour difference can be specified expressed in polar coordinates by calculating rectangular hue instead of rectangular difference: • Conversion from CIELAB is done as follows:
• Inverse to CIELAB:
– C* defines chroma
– Hab defines a hue (angle) • Space is easier to understand for users • If Lightness fixed, then colour can be expressed – along red-green and yellow-blue axes, or – As hue-chroma pair
May 17 Charles A. Wüthrich 24 Colour Difference Metrics: CMC (l:c)
• CIELAB and CIELUV are not as • Following values define an ellypsoid in perceptually uniform as needed LCH colour space • In 1984 the Colour Measurement Committee of the Society of Dyers and Colourists developed the CMC colour difference metric.
• Elaboration of CIELAB color difference, derived from LCH color space • It uses a finer resolution for desaturated colours, to which we are more sensitive • Colour difference is given as a ratio l:c, where where and similarly C and H are averages. – l scale factor for lightness – c scale factor for chroma • Finally def. the colour difference ΔECMC, which measures perceived difference: • To determine the perceptability of the difference between two colors, one sets l=c=1 – Sometimes a ratio 2:1 is used • To compute differences, one computes:
May 17 Charles A. Wüthrich 25 Colour Difference Metrics: CIE 1994
• CIE 1994 is improvement of • Computes first CIE L*a*b* colour difference
• It specifies a set of experimental conditions under which the formula is • Then valid – D65 illumination of color patches set side by side – Each patch covers at least 4º – Illuminance at 1000 lux. from which the metric ΔE*94
• Also derives from CIE LCH, and is parametrized by • It works well, except for weights kL,kC and kH usually saturated blue and near set to 1. neutral colors
May 17 Charles A. Wüthrich 26 Colour Difference Metrics: CIEDE2000
• Additional improvement for • One computes additional where CIE94 did not work well intermediate values:
• Derived from CIELAB • Given two colors, one computes for each
and the average of the two C* ab from which • Then
• From this value, one computes for each color
May 17 Charles A. Wüthrich 27 Colour Difference Metrics: CIEDE2000
• Now we can finally compute the colour difference metric:
May 17 Charles A. Wüthrich 28 Colour Difference Metrics: comparison
original sharpened
CIE e(ab) CIE E(uv)
CMC(1,1) CMC(2,1)
CIE 94 CIE 2000
May 17 Charles A. Wüthrich 29 Colour Order Systems
• These are a conceptual • Natural color system: system of organized colour – Blackness (darkness) perception – Chromaticity (saturation) • Munsell color system: – % of red, yellow, green, blue
• OSA colour system
May 17 Charles A. Wüthrich 30 Applications
• This knowledge can be used – In image understanding, for: classifying edges: – Color matching and transfer • Shadow edges between images • Reflectance edges – Principal component – Understanding illuminance analysis to match colour features spaces between images – Converting colour images to gray images – Rendering into complex colour spaces (not RGB) – Simulating painting methods
May 17 Charles A. Wüthrich 31 Thank you!
• Thank you for your attention! • Web pages http://www.uni-weimar.de/medien/cg
May 17 Charles A. Wüthrich 32