View
3
Download
0
Category
Preview:
Citation preview
Color Image ProcessingMTAT.03.260 Pattern Recognition and Image Analysis (MTAT)
Kristjan Krips Timo Petmanson
University of Tartu
March 18, 2011
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 1 / 39
Outline
1 Fundamentals
2 Color models
3 Pseudo-color processing
4 Full-color processing
5 Color transformations
6 Smoothing and sharpening
7 Color segmentation
8 Noise in color images
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 2 / 39
Visible light
Human eye is sensitive to electromagnetic radiation betweenwavelengths of approximately from 390 nm to 750 nm.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 3 / 39
Human eye reception / primary colors
65% cones are sensitive to red light
33% of cones are sensitive to green light
2% of cones are sensitive to blue light
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 4 / 39
Primary / secondary colors
red + blue = magneta
red + green = yellow
blue + green = cyan
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 5 / 39
Color characteristics
brightness - a subjective measure of chromatic intensity of color
hue - represents the dominant color (dominant wavelenght), e.g. red,blue
saturation - the relative purity of the color, the amount of white lightmixed with the hue.
chromaticity = hue + saturation
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 6 / 39
Trichromatic coe�cients
A color can be speci�ed by its trichromatic coe�cients:
I x = X
X+Y+Z , y = Y
X+Y+Z , z =Z
X+Y+Z , where x+ y + z = 1
X =∫
∞
0 I (λ )x(λ )dλ , Y =∫
∞
0 I (λ )y(λ )dλ , Z =∫
∞
0 I (λ )z(λ )dλ
I (λ ) is the spectral power distribution of a given color,x(λ ),y(λ ),z(λ ) are color matching functions of standard observer eg.combination of three linear light detectors.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 7 / 39
CIE chromaticity diagram
The diagram is the function of red and green. The blue is obtainedfrom equation z = 1− (x+ y).
The colors on the boundary are fully saturated, where the ticks denotethe wavelength in nanometers.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 8 / 39
CIE chromaticity diagram
By connecting any two points with a line in the plot, we get the allpossible combinations of colors that can obtained by mixing theendpoint colors.
Grassman's Law: Any colour can be matched by a linear combinationof three other colours, provided that none of those three can bematched by a combination of the other two
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 9 / 39
sRGB color space and the gamutGamut represents the colors producable of a typical color monitor. Inexperiments carried out by W. David Wright and John Guild, thestandard observer used to set up the sRGB diagram was human.Color matching functions x(λ ), y(λ ), z(λ ) were summarized based onthe experimentsThe vertices of the triangle represent 3 primary colors easilyproducable by monochromatic lines of a mercury vapor discharge.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 10 / 39
RGB model
Derived from primary color components red, green and blue.
Normalized into range [0,1] (in computers typically 0..255])
Color cube:
I black is (0,0,0)I white is (1,1,1)I red is (1,0,0)I green (0,1,0)I blue is (0,0,1)
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 11 / 39
RGB model
http://www.mathworks.com/help/toolbox/images/f8-15484.html
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 12 / 39
RGB <=> CIE color space
1 We need a transfer functions fr , fg , fb for each color channel of themonitor device that de�ne the relationship between input pixel valuesand displayed intensity.
2 The relationship between CIE trimulus values X,Y,Z and displayedimage pixel values R, G, B is given below.
3 The 3x3 matrix can be calculated by deom chromaticity values forthree channels and the white point usually published by themanufacturer. X
YZ
=
Xr Xg Xb
Yr Yg Yb
Zr Zg Zb
∗ fr (R)
fg (G )fb(B)
fr (R)
fg (G )fb(B)
=
Xr Xg Xb
Yr Yg Yb
Zr Zg Zb
(−1)
∗
XYZ
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 13 / 39
Calculating the 3x3 matrixManufacturer usually publishes chromaticity coordinates for theprimaries and the white point.
Colour Chromaticity coordinates
red (xr ,yr ,zr )
green (xg ,yg ,zg )
blue (xb,yb,zb)
white (xw ,yw ,zw )
Assuming that relative luminance equals to 1, we can �nd constantsar ,ag ,ab from the simulanteus equations
arxr +agxg +abxb = xnyn
aryr +agyg +abyb = 1arzr +agzg +abzb = zn
yn
=>
XYZ
=
arxr agxg abxbaryr agyg abybarzr agzg abzb
∗ fr (R)
fg (G )fb(B)
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 14 / 39
CMYK model
Derived from secondary colors.
Used as a main model in printing devices where blending of colorpigements are used to achieve colors.
Equal amounts of cyan, magneta and yellow does not give true black,thus black pigment is additionally used in blending process.
However, this simple transformation is good enough for simpergraphics, but it will produce poor results for applications with higherrequirements such as an colour printer.
CMY <=> RGB
CMY
=
111
− R
GB
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 15 / 39
CMY => CMYK
Black = min(Cyan, Magneta, Yellow)
Cyan = (Cyan - Black) / (1 - Black)
Magneta = (Magneta - Black) / (1 - Black)
Yellow = (Yellow - Black) / (1 - Black)
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 16 / 39
HSL, HSV, (HSI) model
HSL (hue, saturation, lightness) and HSV (hue, saturation, value)model is easily interpretable by humans. They are also two mostcommon cylindrical-coordinate representations of points in an RGBcolor model.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 17 / 39
Basic idea
Starting at the red primary at 0°, passing through the green primary at120° and the blue primary at 240°, and then wrapping back to red at360°.
In each geometry, the central vertical axis comprises the neutral,achromatic, or gray colors, ranging from black at lightness 0 or value0, the bottom, to white at lightness 1 or value 1, the top.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 18 / 39
Hue and chroma
Hue is roughly the angle of a vector representing the color, where chroma isthe length.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 19 / 39
Hue and chroma
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 20 / 39
Lightness
The simplest de�nition is just the average of the three components, inthe HSI model called intensity.
I I = 1
3(R+G +B)
In the HSV "hexcone" model, value is de�ned as the largestcomponent of a color, our M above. This places all three primaries,and also all of the "secondary colors" � cyan, yellow, and magenta �into a plane with white, forming a hexagonal pyramid out of the RGBcube.
I V =M
In the HSL "bi-hexcone" model, lightness is de�ned as the average ofthe largest and smallest color components (�g. 11c). This de�nitionalso puts the primary and secondary colors into a plane, but a planepassing halfway between white and black.
I L= 1
2(M+m)
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 21 / 39
Lightness
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 22 / 39
Saturation
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 23 / 39
HSV => RGB
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 24 / 39
HSL => RGB
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 25 / 39
Pseudo-color (false color) processing / Basic idea
Pseudo-color (false color) processing takes a monochrome image andapplies colors to it.
The idea is to make grayscale images more easily readable andinterpretable to humans.
I mapping intensity ranges to color.I for example we can divide the intensity range [0..1] into subregions and
map a color to each range
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 26 / 39
Gray level to color transformations
Wider range of pseudocolor results, nonlinear
Independent transformation for each primary color
Results are mixed together into a composite image
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 27 / 39
Full-color image processing
Process each component image individually and form a compositeimage
I standard gray-scale image processing methods
Work directly with color pixels
I pixels are vectorsI averaging per-color-component
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 28 / 39
Basic color transformations
Processing the components of an image in a single model
I g (x ,y) = T [f (x ,y)], where f(x,y) is the input image and g(x,y) is theprocessed image
I si = Ti (r1, r2, ..., rn), where i = 1,2,...,n and si , ri denote the colorcomponents of f(x,y), g(x,y) at any point (x,y); n is the number ofcomponents; {T1,T2, ...,Tn}is a set of color transformation functions.
Cost of transformations
I In HSI model transformations are simpleI Converting from RGB, CMY(K) to HSI is di�cult, thus the gain in
total cost would be negative
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 29 / 39
Color complements
Hues that are opposite in the color circle are called complements
Analogous to the gray-scale negatives
Can bring out details in the dark regions of the image
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 30 / 39
Color slicing
Useful for separating objects from the background
Map colors in a range of intrest to a neutral color
si =
{0.5 if
[| rj −aj |> W
2
]any 1≤j≤n
ri otherwise, i = 1,2,...,n
si =
0.5 ifn
∑j=1
(rj −aj)2 > R2
0
ri otherwise, i = 1,2,...,n
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 31 / 39
Tone and color corrections
Important in printing
Tonal range (key type) - general distribution of color intensities
Calibrated imaging systems
I correct inbalances interactively and independentlyI sequential operations, tone correction �rst and then color correction
Methods
I increasing or decreasing the amount of opposite colorI changing the proportions of adjacent colors
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 32 / 39
Tone and color corrections
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 33 / 39
Tone and color corrections
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 34 / 39
Histogram processing
Graylevel histogram processing can be applied to color images
I doing this independently on image components results in imperfectresults
Leave colors unchanged and uniformly change the intensities of thecolors
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 35 / 39
Smoothing and sharpening
Are usually done exactly the same as with gray-scale techiques, butrequire additional steps.
I split the image into channels (R,G,B or HSI)I process all the channels or only one (I channel in HS model) with
grayscale methodsI combine back to original image
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 36 / 39
Color segmentation
Partition image into regions of interest
Segmentation in HSI
I saturation is used for isolating regions of interest
Segmentation in RGB
I better than segmentation in HSII obtain an estimate of the average color that we want to segmentI classify each RGB pixel as having a color in the speci�ed range or notI uses Euclidean distance as the similarity measureI computationally expensiveI use a bounding box as a compromise
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 37 / 39
Noise in color images
Gray-scale noise models can be applied to color images
Di�erent channels can be a�ected di�erently
Filtering out noise
I per image basisI per vector basisI averaging works on both in the same wayI median �ltering does not by default, vectors have to be orderedI more complex with vectors
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 38 / 39
Noise in color images
Sometimes it is more useful to see image in HSL, HSV, HSI colormodels, as it may reveal noisy channels better.
Kristjan Krips, Timo Petmanson (University of Tartu)Color Image Processing March 18, 2011 39 / 39
Recommended