mobile robotics and olfaction lab,130.243.105.49/research/learning/courses/dip/2014/... · 2014....

44
# 1 Achim J. Lilienthal Room T1227, Mo, 11-12 o'clock (please drop me an email in advance) [email protected]

Upload: others

Post on 10-May-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

Mobile Robotics and Olfaction Lab, AASS, Örebro University

# 1

Achim J. Lilienthal

Room T1227, Mo, 11-12 o'clock (please drop me an email in advance)

[email protected]

Page 2: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 3 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

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

General Introduction – Schedule

Page 3: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 4 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

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

Page 4: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 12 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

Colour Fundamentals

1

Page 5: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 13 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

1.

Why Colour? o colour is a powerful descriptor o humans can distinguish colours better than grey levels

Electromagnetic Spectrum

Colour Fundamentals

Page 6: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 19 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

1.

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

Colour Fundamentals

s( )λ r( )λ

detector rods and cones

)(λb

)(λrred-sensitive green-sensitive blue-sensitive

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

Page 7: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 20 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

1.

The "Human Camera"

Colour Fundamentals

445 nm 535 nm 575 nm

Page 8: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 21 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

1.

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

Colour Fundamentals

Page 9: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 22 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

Colour Models

2

Page 10: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 23 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

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)

Colour Models

Page 11: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 24 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

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)

Colour Models

Page 12: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 25 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

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

Colour Models

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

Page 13: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 26 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

Primary Colours o primary colours of light (emitting sources)

» Red, Green, Blue » color monitors » additive mixing

Colour Models

green

blue red

yellow cyan

magenta

Page 14: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 27 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

RGB Images

Colour Models

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);

Page 15: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 28 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

RGB Images

Colour Models

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);

Page 16: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 29 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

RGB Images

Colour Models

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);

Page 17: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 30 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

Secondary Colours o primary colours of pigments (reflecting sources)

» CMY: Cyan, Yellow, Magenta

» printers: CMYK (+ blacK)

» subtractive mixing

Colour Models

green

blue

red

yellow

cyan magenta

Page 18: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 31 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

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

Colour Models

Page 19: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 33 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

CMY/CMYK o hardware oriented (colour printing) o pigment primary colours = secondary colors of light

o example: surface with cyan

pigment illuminated by white light → no red light is reflected

o K (black) added for printing

Colour Models

=

BGR

YMC

111

Page 20: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 34 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

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)

Colour Models

Page 21: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 36 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

RGB to HSI

Colour Models

>−≤

=GBGB

H if360 if

θθ ( ) ( )[ ]

( ) ( )( )

−−+−

−+−= −

BGBRGR

BRGR

2

1 21

cosθ

( ) ( )[ ]BGRBGR

S ,,min31++

−=

( )BGRI ++=31

Page 22: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 37 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

2.

HSI to RGB o RG sector

o GB sector

o BR sector

Colour Models

( )SIB −= 1

+=)60cos(

cos1H

HSIR ( )BRIG +−= 3

1200 <≤ H

240120 <≤ H

)1( SIR −=

−−

+=)180cos()120cos(1

HHSIG

( )GRIB +−= 3

360240 <≤ H

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

−+=

)300cos()240cos(1

HHSIB

Page 23: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 38 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

Pseudocolor Image Processing

3

Page 24: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 39 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

3.

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

» ~ 30 grey levels versus ~ 105 – 106 different colours » display grey level as colour image → easier inspection

Pseudocolor Image Processing

the amount of information is not changed!

Page 25: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 40 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

3.

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

Pseudocolor Image Processing

color1

color2

Page 26: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 42 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

3.

Pseudo Coloring

Pseudocolor Image Processing

fB = imread('Chalk_Original_B.tif'); figure; imshow(fB);

Page 27: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 43 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

3.

Pseudo Coloring

Pseudocolor Image Processing

fB = imread('Chalk_Original_B.tif'); figure; imshow(fB); slfColB = grayslice(fColB, 256); pcfColB = ind2rgb(slfColB, jet(256));

Page 28: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 44 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

3.

Pseudo Coloring

Pseudocolor Image Processing

fB = imread('Chalk_Original_B.tif'); figure; imshow(fB); slfColB = grayslice(fColB, 256); pcfColB = ind2rgb(slfColB, jet(256)); figure; imshow(pcfColB);

Page 29: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 45 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

3.

Pseudo Coloring

Pseudocolor Image Processing

fB = imread('Chalk_Original_B.tif'); figure; imshow(fB); slfColB = grayslice(fColB, 32); pcfColB = ind2rgb(slfColB, flag(32)); figure; imshow(pcfColB);

Page 30: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 46 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

3.

More General Intensity Slicing o 3 independent transformations

» R = fR(x,y), G = fG(x,y), B = fB(x,y) » fR, fG and fB not necessarily piecewise linear

o example: X-ray scanning systems at airports » sinusoidal transform functions

Pseudocolor Image Processing

Page 31: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 48 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

Colour Transformations

4

Page 32: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 49 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

Representation o each pixel interpreted as a vector (r1, ..., rn)

Formulation o per-colour-component transformation

» si = 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

o general vector-based processing » si = Ti (r1, ..., rn)

Colour Transformations

in

out

in

out

in

out

Page 33: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 50 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

Representation o each pixel interpreted as a vector (r1, ..., rn)

Colour Transformations

Page 34: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 53 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

Colour Complement o hues opposite to each other (colour negatives) o enhancing details in dark regions o RGB: si = Ti (ri) o HSI: si ≠ Ti (ri)

Colour Transformations

Page 35: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 54 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

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)

Colour Transformations

Page 36: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 56 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

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)

Colour Transformations

Page 37: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 57 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

Colour Transformations

image enhancement by histogram equalization

HE for each colour component: hue is not preserved...

Page 38: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 59 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

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

» use HE for intensity in HSI

Colour Transformations

original

Page 39: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 60 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

4.

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

» use HE for intensity in HSI

Colour Transformations

histogram equalised I

Page 40: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 62 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

Smoothing and Sharpening of Colour Images

5

Page 41: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 64 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

5.

Smoothing (RGB) o mean filtering in RGB

(neighbourhood: Sxy) o neighbourhood averaging can

be done on a per-colour base

Smoothing and Sharpening of Colour Images

RGB: mean 5x5 for R,G,B

( )

( )( )

( )( )

( )( )

=

xy

xy

xy

Syx

Syx

Syx

yxBK

yxGK

yxRK

yx

,

,

,

,1

,1

,1

,c

Page 42: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 65 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

5.

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)

Smoothing and Sharpening of Colour Images

HSI: mean 5x5 for I

difference

Page 43: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

# 66 DIP'14 © A. J. Lilienthal (Dec 11, 2014)

5.

Sharpening (HSI) o Laplacian applied to I only

Smoothing and Sharpening of Colour Images

RGB: Laplacian 5x5 for R,G,B

( )[ ]( )( )( )

∇∇∇

=∇yxByxGyxR

yx,,,

,2

2

2

2 c

Page 44: Mobile Robotics and Olfaction Lab,130.243.105.49/Research/Learning/courses/dip/2014/... · 2014. 12. 16. · Mobile Robotics and Olfaction Lab, AASS, Örebro University # 1 Achim

Mobile Robotics and Olfaction Lab, AASS, Örebro University

# 86

Achim J. Lilienthal

Room T1227, Mo, 11-12 o'clock (please drop me an email in advance)

[email protected]