digital image processing130.243.105.49/~lilien/dip/lectures/dip_2007_06.pdf · 2007. 3. 23. ·...

47
Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part 6: Colour Image Processing Achim J. Lilienthal AASS Learning Systems Lab, Teknik Room T1216 [email protected] Course Book Chapter 6

Upload: others

Post on 10-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Digital Image Processing

Course IntroductionLecture 1

Digital Image ProcessingPart 6: Colour Image Processing

Achim J. Lilienthal

AASS Learning Systems Lab, Teknik

Room T1216

[email protected]

Course Book Chapter 6

Page 2: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Contents

1. Colour Fundamentals

2. Colour Models

3. Pseudo Color Processing

4. Colour Transformations

5. Smoothing and Sharpening of Colour Images

Page 3: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

→ Contents

Colour Fundamentals

Page 4: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

Why Colour?colour is a powerful descriptor

humans can distinguish colours better than grey levels

Electromagnetic Spectrum

Page 5: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

Electromagnetic Spectrumvisible for humans: 390 – 790 nm

Page 6: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

The "Human Camera"rods and cones

mostly rods

onlycones

cone

rod

blind spotno receptors

Page 7: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

Reflection and Absorptionabsorption

some parts of the energy are absorbed by objects

reflectionreflected light: infra red, red, green, blue

tree water waterwith suspended material

Page 8: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

The "Human Camera"colours are seen as a combination of primary colours

detectorrods and cones

s( )λ r( )λ

Page 9: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

Reflection and Absorptionillumination

achromatic: white or uncoloured

chromatic: colour

monochromatic: only one wavelength (laser)

reflectionno colour we perceive consists of only one wavelength (closest is laser)

dominating wavelength gives the "colour tone" (hue)

equal amount of all wave lengths → grey

s( )λ

r( )λ

Page 10: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

The "Human Camera"colours are seen as a combination of primary colours

detectorrods and cones

s( )λ r( )λ

)(λb

)(λrred-sensitivegreen-sensitiveblue-sensitive

)(λgr(λ), g(λ), b(λ): how cones respond to light of different wave lengths

Page 11: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

575 nmThe "Human Camera" 535 nm445 nm

Page 12: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Fundamentals1

Colour Characteristicsbrightness

perceived intensity (subjective)

hueassociated with the dominant wavelength

saturationrelative purity of a colour (inversely proportional to the amount of white light mixed in)

chromaticityhue and saturation taken together

Page 13: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

→ Contents

Colour Models

Page 14: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

CIE Colour Space, 1931CIE = Commission Internationale de l´Eclairage

based on direct measurements of the human eye

associate each colour with a tristimulus x,y,zx,y,z: amount of primary colors ↔ wave length→ 3D space→ separate brightness and chromaticityspecifies the colourperceived by a standard observer (depends also on the light source)

Page 15: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

CIE Chromaticity (xy) Diagramprojection of the XYZ spacex+y+z=1shows all the chromaticitiesvisible to the average person(gamut of human vision)monochromatic colours (fully saturated) along the edge (spectral locus)less saturated in the "middle"CIE standard white: X=Y=Z(point of equal energy)

Page 16: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

CIE Chromaticity (xy) Diagrameach connection between two points defines colours obtained by additive mixture of these coloursimpossible to produce all colours by mixing three fixed colours:triangle cannot enclose the entire colour regioncolour gamut of RGB monitorsis defined by a triangle

Gamut of the CIE RGB primaries and location on the CIE 1931 xy chromaticity diagram

Page 17: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

Primary Coloursprimary colours of light (emitting sources)

Red, Green, Blue

color monitors

additive mixing green

bluered

yellow cyan

magenta

Page 18: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

Secondary Coloursprimary colours of pigments (reflecting sources)

CMY: Cyan, Yellow, Magenta

printers: CMYK (+ blacK)

subtractive mixinggreen

blue

red

yellow

cyanmagenta

Page 19: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

RGBhardware oriented (monitor)

range [0,1] for each primary colour of light

RGB image = three grey-level images

24 Bits: 16.7 million colours(~350000 we can distinguish)

RGB in three corners

black, white and CMY in the other corners

grey along the diagonal

Page 20: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

safe RGB Colourslikely to be reproduced faithfully independent of the viewer hardware

216 combinations of 0, 51, 102, 153, 204, or 255

safe RGB color cube

Page 21: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

CMY/CMYKhardware oriented (colour printing)

pigment primary colours = secondary colors of light

example: surface with cyan pigment illuminated by white light → no red light is reflected

K (black) added for printing

⎥⎥⎥

⎢⎢⎢

⎡−

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

BGR

YMC

111

Page 22: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

HSIHue, Saturation, Intensity

suitable for description and interpretation

separates intensity and hue

resembles human vision

difficult to display directly (transformation to RGB necessary)

! singularities (hue is undefined if the saturation is zero)

Page 23: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

RGB to HSI

( ) ( )[ ]

( ) ( )( )⎪⎭

⎪⎬

⎪⎩

⎪⎨

−−+−

−+−= −

BGBRGR

BRGR

2

1 21

cosθ⎩⎨⎧

>−≤

=GBGB

H if360 if

θθ

( ) ( )[ ]BGRBGR

S ,,min31++

−=

( )BGRI ++=31

Page 24: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Models2

HSI to RGBRG sector

GB sector

BR sector

( )SIB −= 1⎥⎦

⎤⎢⎣

⎡−

+=)60cos(

cos1HHSIR

o ( )BRIG +−= 3

oo 1200 <≤ H

oo 240120 <≤ H

)1( SIR −= ⎥⎦

⎤⎢⎣

⎡−−

+=)180cos()120cos(1

HHSIG

o

o

( )GRIB +−= 3

oo 360240 <≤ H

( )BGIR +−= 3 ( )SIG −= 1 ⎥⎦

⎤⎢⎣

⎡−

−+=

)300cos()240cos(1

HHSIB

o

o

Page 25: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

→ Contents

Pseudocolor Image Processing

Page 26: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Pseudocolor Image Processing3

Why Pseudo Colours?humans can distinguish colours better than grey levels

~ 30 grey levels versus ~ 350 000 different colours

display grey level as colour image → easier inspection

the amount of information is not changed!

Page 27: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Pseudocolor Image Processing3

Two Colour Intensity Slicingimage is interpreted as 3D function (x,y,intensity)

assign different colours to each side of the plane

two-color image

color1

color2

Page 28: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Pseudocolor Image Processing3

Example – Lake Mälardalen (1997)

chlorophyll suspended material dissolved organic

Page 29: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Pseudocolor Image Processing3

More General Intensity Slicing3 independent transformations

R = fR(x,y), G = fG(x,y), B = fB(x,y)

fR, fG and fB not necessarily piecewise linear

example: X-ray scanning systems at airportssinusoidal transform functions

Page 30: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Pseudocolor Image Processing3

More General Intensity Slicingcombine several monochrome images

example: multispectral imagemonochrome images from different spectral bands

Page 31: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

→ Contents

Colour Transformations

Page 32: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Representationeach pixel interpreted as a vector (r1, ..., rn)

Formulationgeneral vector-based processing

si = Ti (r1, ..., rn)

per-colour-component transformationsi = Ti (ri)

per-colour-component process = vector-based process

• if process is applicable to vectors and scalars ...

• ... and operation is independent of the other components

in

out

in

out

in

out

Page 33: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Representationeach pixel interpreted as a vector (r1, ..., rn)

Page 34: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Representationeach pixel interpreted as a vector (r1, ..., rn)

Page 35: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Intensity Adjustmentg(x,y)=kf(x,y)+m

HSI: s3=k⋅r3

RGB: si=k⋅ri

CMY: si=k⋅ri+(1-k)

! remember to take into account the cost of conversion

contrast

brightness

Page 36: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Colour Complementhues opposite one another (colour negatives)

enhancing details in dark regions

RGB: si = Ti (ri)

HSI: si ≠ Ti (ri)

Page 37: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Colour Slicingto highlight a specific range of coloursto define a mask for further processinghow to define the range of interest ?

hypercube/sphere (centered at a prototypical colour)multiple colour prototypes (ranges of interest)

Page 38: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Tonal Transformationsadjust the brightness and contrast in the image

colours are not changed

tonal transformations normally are selected interactively

Colour Correctionscorrections normally are selected interactively

visual assessment of suitable regionswhite areas (RGB/CMY components should be equal)

skin tones (humans are highly perceptive of skin tones)

! perception of colour is affected by surrounding colours

Page 39: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Tonal Transformationsadjust the brightness and contrast in the image

colours are not changed

tonal transformations normally are selected interactively

colour histogram equalization ?

Colour Correctionscorrections normally are selected interactively

visual assessment of suitable regionswhite areas (RGB/CMY components should be equal)

skin tones (humans are highly perceptive of skin tones)

Page 40: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Histogram Equalisation (HE)how to generalise grey level HE to colour HE?

use HE for intensity in HSI

! applying HE to the colour components independently is not a good idea

original

Page 41: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4image enhancement by histogram equalization

component by component:hue is not preserved...

Page 42: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Colour Transformations4

Histogram Equalisation (HE)how to generalise grey level HE to colour HE?

use HE for intensity in HSI

! hue is not preserved when applying HE to the colour components independently

histogram equalised I

Page 43: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

→ Contents

Smoothing and Sharpeningof Colour Images

Page 44: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Smoothing and Sharpening of Colour Images5

Smoothing (RGB)mean filtering in RGB(neighbourhood: Sxy)

neighbourhood averaging can be done on a per-colour base

( )

( )( )

( )( )

( )( )

⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢

=

xy

xy

xy

Syx

Syx

Syx

yxBK

yxGK

yxRK

yx

,

,

,

,1

,1

,1

,c

RGB: mean 5x5 for R,G,B

Page 45: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Smoothing and Sharpening of Colour Images5

Smoothing (HSI)filter intensity channel only

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

Page 46: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Smoothing and Sharpening of Colour Images5

Sharpening (HSI)Laplacian applied to I only

( )[ ]( )( )( )⎥

⎥⎥

⎢⎢⎢

∇∇∇

=∇yxByxGyxR

yx,,,

,2

2

2

2 c

RGB: Laplacian 5x5 for R,G,B

Page 47: Digital Image Processing130.243.105.49/~lilien/dip/lectures/DIP_2007_06.pdf · 2007. 3. 23. · Digital Image Processing Course Introduction Lecture 1 Digital Image Processing Part

Achim J. Lilienthal

Smoothing and Sharpening of Colour Images5

Sharpening (RGB)Laplacian can be calculated on a per-colour base

difference

HSI: Laplacian 5x5 for I