images and colour
DESCRIPTION
Images and colour. Colour - colours - colour spaces - colour models Raster data - image representations - single and multi-band (multi-channel) images - colour lookup tables - operations on images. Colour images. Colour images have two components: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/1.jpg)
Images and colour
Colour
- colours
- colour spaces
- colour models
Raster data
- image representations
- single and multi-band (multi-channel) images
- colour lookup tables
- operations on images
![Page 2: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/2.jpg)
Colour images
• Colour images have two components:– raster data - an array of pixels;– colour model - a description of how pixels are mapped to
colours.
• A pixel is defined in terms of its components in a particular colour space
![Page 3: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/3.jpg)
Colour spectrum – visible light
400 nm 700 nm
Ultraviolet Infrared
![Page 4: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/4.jpg)
Colour spaces
• A colour space represents a system for measuring colours
• Most colours can be represented using three colour components
• They are called the primary colours (or the primaries)
![Page 5: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/5.jpg)
Colour spaces
• There are many colour spaces.
• The choice of a particular space depends on the context in which we want to describe colours. The four most common colour spaces are:– RGB– HSV– CMY– XYZ
![Page 6: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/6.jpg)
RGB
• Primaries: Red - Green - Blue• Similar to colours detected by colour receptors in the
eye• Also used in TV technology
White
Black
Blue Cyan
Green
Magenta
Red Yellow
![Page 7: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/7.jpg)
RGB
![Page 8: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/8.jpg)
RGB – an additive system
![Page 9: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/9.jpg)
HSV
• Primaries: Hue - Saturation - Value• Colour space related to subjective description of
colours
Black
Green Yellow
Red
MagentaBlue
Cyan White
![Page 10: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/10.jpg)
HSV
![Page 11: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/11.jpg)
CMY
• Primaries: Cyan - Magenta – Yellow
• Used in printing technology• Mixing is subtractive
![Page 12: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/12.jpg)
CMY – subtractive system
![Page 13: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/13.jpg)
CIE XYZ
• Primaries: X, Y, Z• Based on colour perception by humans• Device independent
• The most common representation of the CIE XYZ space is the CIE chromacity diagram
![Page 14: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/14.jpg)
CIE XYZ
Chromacity diagram
![Page 15: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/15.jpg)
Monochrome images
• Images represented by a single primary - a value
• Show only shades of grey
• Binary images use only two shades of grey: black and white.
![Page 16: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/16.jpg)
Vector notation for colours
[ Primary1 Primary2 Primary 3 ]
[ R G B ] yellow = [ 1 1 0 ]
orange = [ 1 0.5 0 ]
pink = [ 1 0.7 0.7]
[ H S V ] pink = [ 0 0.3 1 ]
[ C M Y ] red = [ 0 1 1 ]
![Page 17: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/17.jpg)
Colour space conversion
• Colours can be converted from one space to another
• Conversion from RGB to CMY:
[ C M Y ] = [ 1 1 1 ] - [ R G B ]
• Example: Convert green from RGB to CMY
[ C M Y ] = [ 1 1 1 ] - [ 0 1 0 ] = [ 1 0 1 ]
![Page 18: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/18.jpg)
Conversion from RGB to XYZ
• Each of the R, G and B primaries is a weighted sum of X, Y and Z primaries
• Weights expressed in matrix notation, e.g.
0.41 0.21 0.02
0.36 0.71 0.120.18 0.07 0.95
![Page 19: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/19.jpg)
Conversion from RGB to XYZ
• Conversion implemented as a matrix multiplication
[ X Y Z ] = [ R G B ] ·
0.584 0.311 0.047
0.188 0.614 0.1030.179 0.075 0.939
![Page 20: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/20.jpg)
Raster data
• Colour• - colours• - colour spaces• - colour models • Raster data• - image representations• - single and multi-band (multi-channel) images• - colour lookup tables• - operations on images
![Page 21: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/21.jpg)
Raster data - pixel structure
• Raster data - an image
• Pixels arranged as a rectangular array
• The structure of a pixel depends on – the colour space – the colour model
![Page 22: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/22.jpg)
Raster array Pixel structure
![Page 23: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/23.jpg)
Raster data - pixel structure
• Binary images– pixel represented by a single bit
• Monochrome images– pixel represented by a single byte (a one-dimensional
vector)
• Colour images– usually represented by a 3-dimensional vector– examples [ R G B], [H S V] or [C M Y]
![Page 24: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/24.jpg)
Representations: Java terminology
• Normal representation– the amount of each primary defined by a number in the
range [0,1] – Example: pink (RGB): [1.0 0.5 0.5]
• Logical representation– Pixel representation as a vector
• Physical representation– depicted by the Colour Model
![Page 25: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/25.jpg)
Colour channel
• Colour channel - a component of a colour vector• RGB: red channel, green channel and blue channel
• A pixel vector can have more than three channels
• Examples– alpha channel (often used to describe transparency of a
pixel)– z channel (in 3D graphics, the depth of the pixel, used in
hidden surface removal)
![Page 26: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/26.jpg)
Colour models
A colour model describes how pixels are mapped into colours.
![Page 27: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/27.jpg)
Direct Colour (True Colour)
• Image is an array of vectors
• Each vector directly encodes values of the three primaries
![Page 28: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/28.jpg)
Packed Colour Model (Packed Array)
• Image is an array of values, each encoding a colour• Examples:
– 4-byte integer aaaaaaaa bbbbbbbb gggggggg rrrrrrrr
– 1-byte integer
rrrgggbb
![Page 29: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/29.jpg)
Indexed Colour Model
• The most commonly used representation on smaller workstations
• A pixel value (or a value of a pixel component) is an index (a pointer) to a table containing colour definitions
![Page 30: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/30.jpg)
Colour Map
• Synonyms:– Colour Lookup Table– CLUT– LUT
• Each location in a LUT stores a colour definition for a pixel with a given value
![Page 31: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/31.jpg)
Colour mapping for 1-byte pixels
Colour mapR
G
B
R
GB
Cell
Pixel value
128
128
0255255
![Page 32: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/32.jpg)
Colour mapping for 3-dimensional pixel vectors
Colour map
R
G
B
R
GB
Red
Green
Blue
![Page 33: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/33.jpg)
Operations on images:Changing pixel colours
• Changing pixel colours is very easy within the Indexed Colour Model
• A raster array containing pixel values (or pixel vectors) stays unchanged.
• Only colour definitions in the LUT are changing
![Page 34: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/34.jpg)
Colour mapping functions: Grey level mapping
Input
Output R
Input
Output G
Input
Output B
![Page 35: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/35.jpg)
Inverse mapping
Input
Output R
Input
Output G
Input
Output B
![Page 36: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/36.jpg)
“Hot colours” mapping
Input
Output R
Input
Output G
Input
Output B
![Page 37: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/37.jpg)
Changing pixel values: Convolution
• Convolution: a spatial filtering technique• calculates a weighted average of several pixels lying
within a small neighbourhood, normally 3x3 square,
• The 3x3 neighbourhood is called a kernel. • The effects depend on the values of weights.
![Page 38: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/38.jpg)
Examples of smoothing kernels
1/9
1/9
1/9 1/9
1/9
1/9 1/9 1/9 1/10
1/10 1/10
1/10
1/10
1/10
1/10
1/5
1/10
1/9
1/8
1/16 1/16
1/8
1/8
1/8
1/16
1/4
1/16
![Page 39: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/39.jpg)
Original image Image after smoothing
![Page 40: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/40.jpg)
Examples of sharpening kernels
-1
-1
9 -1
-1
-1 -1 -1 -1
0 0
-1
-1
-1
0
5
0
-1
-2
1 1
-2
-2
-2
1
5
1
![Page 41: Images and colour](https://reader034.vdocuments.mx/reader034/viewer/2022051402/5681580c550346895dc57c30/html5/thumbnails/41.jpg)
Original image Image after sharpening