Achim J. Lilienthal Mobile Robotics and Olfaction Lab, Room T1227, Mo, 11-12 o'clock AASS, Örebro University (please drop me an email in advance) achim.lilienthal@oru.se 1
2. General Introduction Schedule Lectures 1. Week 47: Mon, Nov 17, 2014, 10:15-12:00 o'clock, T131 2. Week 47: Tue, Nov 18, 2014, 10:15-12:00 o'clock, T127 3. Week 47: Thu, Nov 20, 2014, 10:15-12:00 o'clock, T127 4. Week 48: Tue, Nov 25, 2014, 10:15-12:00 o'clock, T127 5. Week 48: Thu, Nov 27, 2014, 10:15-12:00 o'clock, T127 6. Week 49: Tue, Dec 2, 2014, 10:15-12:00 o'clock, T127 7. Week 49: Thu, Dec 4, 2014, 10:15-12:00 o'clock, T127 8. Week 50: Tue, Dec 9, 2014, 10:15-12:00 o'clock, T127 9. Week 50: Thu, Dec 11, 2014, 10:15-12:00 o'clock, T127 10. Week 51: Tue, Dec 16, 2014, 10:15-12:00 o'clock, T127 Exercises 1. Week 47: Wed, Nov 19, 2014, 08:15-12:00 o'clock, T124 2. Week 48: Wed, Nov 26, 2014, 08:15-12:00 o'clock, T124 3. Week 50: Wed, Dec 10, 2014, 08:15-12:00 o'clock, T124 3
Contents 1. Colour Fundamentals 2. Colour Models 3. Pseudo Color Processing 4. Colour Transformations 5. Smoothing and Sharpening of Colour Images 6. Colour Edge Detection 4
1 Colour Fundamentals 12
1. Colour Fundamentals Why Colour? o colour is a powerful descriptor o humans can distinguish colours better than grey levels Electromagnetic Spectrum 13
1. Colour Fundamentals The "Human Camera" o colours are seen as a combination of primary colours s( λ) r( λ) r(λ), g(λ), b(λ): how cones respond to light of different wave lengths detector rods and cones red-sensitive green-sensitive blue-sensitive r(λ) g(λ) b(λ) 19
1. Colour Fundamentals The "Human Camera" 445 nm 535 nm 575 nm 20
1. Colour Fundamentals Colour Characteristics o brightness» perceived intensity (subjective) o hue» associated with the dominant wavelength o saturation» relative purity of a colour (inversely proportional to the amount of white light mixed in) o chromaticity» hue and saturation taken together 21
2 Colour Models 22
2. Colour Models CIE Colour Space, 1931 o CIE = Commission Internationale de l Eclairage o based on direct measurements of the human eye o associate each colour with a tristimulus x,y,z x,y,z: amount of primary colors wave length 3D space separate brightness and chromaticity o specifies the colour perceived by a standard observer (depends also on the light source) 23
2. Colour Models CIE Chromaticity (xy) Diagram o projection of the XYZ space x+y+z=1 o shows all the chromaticities visible to the average person (gamut of human vision) o monochromatic colours (fully saturated) along the edge (spectral locus) o less saturated in the "middle" o CIE standard white: X=Y=Z (point of equal energy) 24
2. Colour Models CIE Chromaticity (xy) Diagram o each connection between two points defines colours obtained by additive mixture of these colours o impossible to produce all colours by mixing three fixed colours: triangle cannot enclose the entire colour region o colour gamut of RGB monitors is defined by a triangle Gamut of the CIE RGB primaries and location on the CIE 1931 xy chromaticity diagram 25
2. Colour Models Primary Colours o primary colours of light (emitting sources)» Red, Green, Blue» color monitors» additive mixing green yellow cyan red magenta blue 26
2. Colour Models RGB Images fr = imread('chalk_original_r.tif'); figure; imshow(fr); fg = imread('chalk_original_g.tif'); figure; imshow(fg); fb = imread('chalk_original_b.tif'); figure; imshow(fb); 27
2. Colour Models RGB Images fr = imread('chalk_original_r.tif'); figure; imshow(fr); fg = imread('chalk_original_g.tif'); figure; imshow(fg); fb = imread('chalk_original_b.tif'); figure; imshow(fb); fcolrgb = cat(3, fcolr, fcolg, fcolb); 28
2. Colour Models RGB Images fr = imread('chalk_original_r.tif'); figure; imshow(fr); fg = imread('chalk_original_g.tif'); figure; imshow(fg); fb = imread('chalk_original_b.tif'); figure; imshow(fb); fcolrgb = cat(3, fcolr, fcolg, fcolb); figure; imshow(fcolrgb); 29
2. Colour Models Secondary Colours o primary colours of pigments (reflecting sources)» CMY: Cyan, Yellow, Magenta» printers: CMYK (+ black)» subtractive mixing yellow red green magenta blue cyan 30
2. Colour Models RGB Cube o hardware oriented (screens) o range [0,1] for each primary colour of light o RGB image = three grey-level images o 24 Bits: 16.7 million colours (~350000 we can distinguish) o RGB in three corners o black, white and CMY in the other corners o grey along the diagonal 31
2. Colour Models CMY/CMYK o hardware oriented (colour printing) o pigment primary colours = secondary colors of light C M Y = 1 R 1 G 1 B o example: surface with cyan pigment illuminated by white light no red light is reflected o K (black) added for printing 33
2. Colour Models HSI o Hue, Saturation, Intensity o suitable for description and interpretation o separates intensity and hue o resembles human vision o difficult to display directly (transformation to RGB necessary)! singularities (hue is undefined if the saturation is zero) 34
2. Colour Models RGB to HSI H = 1 θ if B G [( R G) + ( R B) ] 1 θ = cos 2 360 θ if B > G 2 R G + R B G ( ) ( )( B) S 3 = 1, [ min( R, G B) ] ( R + G + B) ( R + G B) 1 I = + 3 36
2. Colour Models HSI to RGB o RG sector = I 1 + 0 H <120 S cos H cos(60 H ) R G = 3I ( R + B) B = I 1 ( S ) o GB sector 120 < 240 H R S cos( H 120 ) = I( 1 S) G = I 1 + cos(180 H ) ( R G) B = 3I + o BR sector 240 H < 360 = 3 I ( G B) G I( S ) R + S cos( H 240 ) = 1 B = I 1 + cos(300 H ) 37
3 Pseudocolor Image Processing 38
3. Pseudocolor Image Processing Why Pseudo Colours? o humans can distinguish colours better than grey levels» ~ 30 grey levels versus ~ 10 5 10 6 different colours» display grey level as colour image easier inspection the amount of information is not changed! 39
3. Pseudocolor Image Processing Two Colour Intensity Slicing o image is interpreted as 3D function (x,y,intensity) o assign different colours to each side of the plane o two-color image color1 color2 40
3. Pseudocolor Image Processing Pseudo Coloring fb = imread('chalk_original_b.tif'); figure; imshow(fb); 42
3. Pseudocolor Image Processing Pseudo Coloring fb = imread('chalk_original_b.tif'); figure; imshow(fb); slfcolb = grayslice(fcolb, 256); pcfcolb = ind2rgb(slfcolb, jet(256)); 43
3. Pseudocolor Image Processing Pseudo Coloring fb = imread('chalk_original_b.tif'); figure; imshow(fb); slfcolb = grayslice(fcolb, 256); pcfcolb = ind2rgb(slfcolb, jet(256)); figure; imshow(pcfcolb); 44
3. Pseudocolor Image Processing Pseudo Coloring fb = imread('chalk_original_b.tif'); figure; imshow(fb); slfcolb = grayslice(fcolb, 32); pcfcolb = ind2rgb(slfcolb, flag(32)); figure; imshow(pcfcolb); 45
3. Pseudocolor Image Processing More General Intensity Slicing o 3 independent transformations» R = f R (x,y), G = f G (x,y), B = f B (x,y)» f R, f G and f B not necessarily piecewise linear o example: X-ray scanning systems at airports» sinusoidal transform functions 46
4 Colour Transformations 48
4. Colour Transformations Representation o each pixel interpreted as a vector (r 1,..., r n ) Formulation o per-colour-component transformation» s i = T i (r i )» per-colour-component process = vector-based process if process is applicable to vectors and scalars...... and operation is independent of the other components o general vector-based processing» s i = T i (r 1,..., r n ) out out out in in in 49
4. Colour Transformations Representation o each pixel interpreted as a vector (r 1,..., r n ) 50
4. Colour Transformations Colour Complement o hues opposite to each other (colour negatives) o enhancing details in dark regions o RGB: s i = T i (r i ) o HSI: s i T i (r i ) 53
4. Colour Transformations Colour Slicing o to highlight a specific range of colours o to define a mask for further processing o how to define the range of interest?» hypercube/sphere/ellipsoid (centred at a mean colour)» multiple colour prototypes (ranges of interest) 54
4. Colour Transformations Tonal Transformations o adjust the brightness and contrast in the image o colours are not changed o tonal transformations normally are selected interactively o colour histogram equalization? Colour Corrections o corrections normally are selected interactively o visual assessment of suitable regions» white areas (RGB/CMY components should be equal)» skin tones (humans are highly perceptive of skin tones) 56
4. Colour Transformations image enhancement by histogram equalization HE for each colour component: hue is not preserved... 57
4. Colour Transformations Histogram Equalisation (HE) o how to generalise grey level HE to colour HE?» use HE for intensity in HSI original 59
4. Colour Transformations Histogram Equalisation (HE) o how to generalise grey level HE to colour HE?» use HE for intensity in HSI histogram equalised I 60
5 Smoothing and Sharpening of Colour Images 62
5. Smoothing and Sharpening of Colour Images Smoothing (RGB) o mean filtering in RGB (neighbourhood: S xy ) o neighbourhood averaging can be done on a per-colour base c ( x, y) 1 K 1 = K 1 K ( x, y ) ( x, y ) ( x, y ) S S S R xy G xy B xy ( x, y) ( x, y) ( x, y) RGB: mean 5x5 for R,G,B 64
5. Smoothing and Sharpening of Colour Images Smoothing (HSI) o filter intensity channel only o not identical to RGB smoothing since the average of two colours is a mixture of them (neither of the original colours) difference HSI: mean 5x5 for I 65
5. Smoothing and Sharpening of Colour Images Sharpening (HSI) o Laplacian applied to I only [ ( x, y) ] 2 c = 2 2 2 ( x, y) R ( ) ( ) G x, y B x, y RGB: Laplacian 5x5 for R,G,B 66
Achim J. Lilienthal Mobile Robotics and Olfaction Lab, Room T1227, Mo, 11-12 o'clock AASS, Örebro University (please drop me an email in advance) achim.lilienthal@oru.se 86