Image Acquisition
Image Acquisition
Image Acquisition
- Image Digitization
Spatial domain
Intensity domain
1
2
What is an Image ?
An image is a projection of a 3D scene into a 2D
projection plane.
An image can be defined as a 2 variable function
f(x,y): R
2
R , where for each position (x,y) in the
projection plane, f(x,y) defines the light intensity at this
point.
Image as a function
3
4
i(x,y)
r(x,y)
f(x,y)=i(x,y)r(x,y)
g(i,j)
Image Acquisition
pixel=picture element
Acquisition System
5
World Camera Digitizer
Digital
Image
CMOS sensor
Image Types
Three types of images:
Binary images
g(x,y) e {0 , 1}
Gray-scale images
g(x,y) e C
typically c={0,,255}
Color Images
three channels:
g
R
(x,y)eC g
G
(x,y)eC g
B
(x,y)eC
6
Gray Scale Image
7
210 209 204 202 197 247 143 71 64 80 84 54 54 57 58
206 196 203 197 195 210 207 56 63 58 53 53 61 62 51
201 207 192 201 198 213 156 69 65 57 55 52 53 60 50
216 206 211 193 202 207 208 57 69 60 55 77 49 62 61
221 206 211 194 196 197 220 56 63 60 55 46 97 58 106
209 214 224 199 194 193 204 173 64 60 59 51 62 56 48
204 212 213 208 191 190 191 214 60 62 66 76 51 49 55
214 215 215 207 208 180 172 188 69 72 55 49 56 52 56
209 205 214 205 204 196 187 196 86 62 66 87 57 60 48
208 209 205 203 202 186 174 185 149 71 63 55 55 45 56
207 210 211 199 217 194 183 177 209 90 62 64 52 93 52
208 205 209 209 197 194 183 187 187 239 58 68 61 51 56
204 206 203 209 195 203 188 185 183 221 75 61 58 60 60
200 203 199 236 188 197 183 190 183 196 122 63 58 64 66
205 210 202 203 199 197 196 181 173 186 105 62 57 64 63
x = 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
y =
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Color Image
8
Notations
Image Intensity -
Light energy emitted from a unit area in the image
Device dependence
Image Brightness -
The subjective appearance of a unit area in the image
Context dependence
Subjective
Image Gray-Level -
The relative intensity at each unit area
Between the lowest intensity (Black value) and the highest
intensity (White value)
Device independent
9
Intensity vs. Brightness
10
11
I
n
t
e
n
s
i
t
y
Af
1
Af
2
f2
f1
f
1
< f
2
, Af
1
= Af
2
Equal intensity steps:
Equal brightness steps:
Intensity vs. Brightness
Weber Law
Describe the relationship between the physical magnitudes
of stimuli and the perceived intensity of the stimuli.
In general, Af needed for just noticeable difference (JND)
over background f was found to satisfy:
12
const
f
f
=
A
Brightness log(f)
What about Color Space?
JND in XYZ color space
was measured by Wright
and Pitt,
and MacAdam in
the thirties
MacAdam ellipses: JND
plotted at the CIE-xy
diagram
Conclusion: measuring
perceptual distances in the
cie-XYZ space is not a
good idea
Perceptually Uniform Color Space
Most common: CIE-L*a*b* (CIELAB) color space.
L* represents luminance.
a* represents the difference between green and red, and
b* represents the difference between yellow and blue.
Perceptually Uniform Color Space
XYZ to CIELAB conversion:
where (X
0
,Y
0
,Z
0
) are the XYZ values of a reference white
point
( ) ( ) | |
( ) ( ) | |
( )
( )
>
=
=
=
otherwise Y Y
Y Y for Y Y
L
Z Z X X b
Y Y X X a
0
0
3 / 1
0
*
3 / 1
0
3 / 1
0
*
3 / 1
0
3 / 1
0
*
903
01 . 0 16 116
200
500
100 100 100 100 100
100 0 0 0 100
100 0 0 0 100
100 0 0 0 100
100 100 100 100 100
Digitization
Two stages in the digitization process:
Spatial sampling: Spatial domain
Quantization: Gray level
16
f
x
y
1 2 3 4 5
1
2
3
4
5
f(x,y)
Continuous Image Digital Image
g(i,j)
e C
j
i
Spatial Sampling
When a continuous scene is imaged on
the sensor, the continuous image is
divided into discrete elements - picture
elements (pixels)
Spatial Sampling
0
x
Sampling
The density of the sampling denotes the
separation capability of the resulting image
Image resolution defines the finest
details that are still visible by the image
We use a cyclic pattern to test the
separation capability of an image
frequency
1
Wavelength
length unit
cycles of number
Frequency
=
=
Sampling Rate
1D Example:
0
Nyquist Frequency
Nyquist Rule: To observe details at frequency f
(wavelength d) one must sample at frequency > 2f
(sampling intervals < d/2)
The Frequency 2f is the Nyquist Frequency.
Aliasing: If the pattern wavelength is less than 2d
erroneous patterns may be produced.
Aliasing - Moir Patterns
Temporal Aliasing
Temporal Aliasing Example
Image De-mosaicing
Can we do better than Nyquist?
A joint Histogram of r
x
v.s. g
x
Red derivative
G
r
e
e
n
d
e
r
i
v
a
t
i
v
e
100 200 300 400 500
50
100
150
200
250
300
350
400
450
500
Image De-mosaicing
Basic idea: use correlations between color
bands
Quantization
Choose number of gray levels (according
to number of assigned bits)
Divide continuous range of intensity values
Quantization
Quantization
8 bits image 4 bits image
Low freq. areas are more sensitive to
quantization
0 10 20 30 40 50 60 70 80 90 100
0
2
4
6
8
10
How should we quantize an image?
Simplest approach: uniform quantization
G
r
a
y
-
L
e
v
e
l
Sensor Voltage
2
1 i i
i
Z Z
q
+
=
+
K
Z Z
Z Z
k
i i
0
1
=
+
Z
0
Z
1
Z
2
Z
3
Z
4
Z
k-1
Z
k
. . . .
q
0
q
1
q
2
q
3
q
k-1
. . . . . . . .
sensor
voltage
quantization
level
Non-uniform Quantization
Quantize according to visual sensitivity
(Webers Law)
Non uniform sensor voltage distribution
Z
7
Z
6
Z
5
Z
4
Z
3
Z
1
Z
0
Z
2
q
6
q
5
q
3
q
2
q
0
q
4
q
1
Low Visual
Sensitivity
High Visual
Sensitivity
Optimal Quantization (Lloyd-Max)
Content dependant
Minimize quantization error
q
0
q
1
q
2
q
3
sensor
voltage
quantization
level
Z
0
Z
1
Z
2
Z
3
Z
4
Optimal Quantization (Lloyd-Max)
Also known as Loyd-Max quantizer
Denote P(z) the probability of sensor voltage
The quantization error is :
Solution:
Iterate until convergence (but optimal minimum is not
guaranteed).
( )( ) dz q z z P E
k
i
z
z
i
i
i
=
+
=
1
0
2
1
( )
( )
}
}
+
+
=
1
1
i
i
i
i
z
z
z
z
i
dz z P
dz z zP
q
2
1 i i
i
q q
z
+
=
Example
8 bits image
4 bits image
Uniform quantization
4 bits image
Optimal quantization
Common color resolution for high quality images is
256 levels for each Red, Greed, Blue channels, or
256
3
= 16777216 colors.
How can an image be displayed with fewer colors
than it contains?
Select a subset of colors (the colormap or pallet) and
map the rest of the colors to them.
from: Daniel Cohen-Or
Color Quantization
With 8 bits per pixel and color look up table we can
display at most 256 distinct colors at a time.
To do that we need to choose an appropriate set of
representative colors and map the image
into these colors
from: Daniel Cohen-Or
126 14 111
36 36 111
36
111
5 12
12 17
17 111
14
126
17
36
12
111
36 36 200 12
14
126 17
36 36
111
12
14
36 36 200 12
Color Quantization
from: Daniel Cohen-Or
2
colors
256
colors
16
colors
4
colors
Color Quantization
Color Quantization
Nave (uniform) Color
Quantization 24 bit to 8 bit:
Retaining 3-3-2 most
significant bits of the R,G
and B components.
false contours
from: Daniel Cohen-Or
Median Cut
R
G
B
Median Cut
from: Daniel Cohen-Or
Median Cut
from: Daniel Cohen-Or
Median Cut
from: Daniel Cohen-Or
Median Cut
from: Daniel Cohen-Or
Median Cut
from: Daniel Cohen-Or
Color_MedCut (Image, n){
For each pixel in Image with color C, map C in RGB space;
B = {RGB space};
While (n-- > 0) {
L = Heaviest (B);
Split L into L1 and L2;
Remove L from B, and add L1 and L2 instead;
}
For all boxes in B do
assign a representative (color centroid);
For each pixel in Image do
map to one of the representatives;
}
The median cut algorithm
from: Daniel Cohen-Or
Better Solution
from: Daniel Cohen-Or
Generalized Lloyed Algorithm (GLA)
p
i
( ) 0
i
q
( ) 1
i
q
from: Daniel Cohen-Or
Generalized Lloyed Algorithm (GLA)
( ) 1
i
q
p
i
( ) 0
i
q
from: Daniel Cohen-Or
Generalized Lloyed Algorithm (GLA)
( ) 2
i
q
p
i
( ) 1
i
q
from: Daniel Cohen-Or
Color_GLloyd(Image, K) {
- Guess K cluster centre locations
- Repeat until convergence {
- For each data point finds out which centre its closest to
- For each centre finds the centroid of the points it owns
- Set a new set of cluster centre locations
- optional: split clusters with high variance
}
}
The GLA algorithms aims at minimizing the quantization
error:
( )
= e
=
K
i C j
i j
i
q p E
1
2
8 bit 4 bit 24 bit
from: Daniel Cohen-Or
More on Color Quantization
Observation 1: Distances and quantization errors
measured in RGB space, do not relate to human
perception.
Solution: Apply quantization in perceptually uniform
color space (such as CIELAB).
More on Color Quantization
Original
RGB Quantization Lab Quantization
More on Color Quantization
Observation 2: Quantization errors are spatially
dependent: we are more sensitive to errors at lower
spatial frequencies.
1 3 10 30 100
S
e
n
s
i
t
i
v
i
t
y
Spatial Frequency
More on Color Quantization
Solution: Assign weight for each pixel color
Using this scheme we minimize:
0
50
100
150
200
250
0
100
200
300
0
50
100
150
200
250
W
w
W
w
W
W
( )
= e
=
1
0
2
k
i C j
i j j
i
q p w E
Original
Standard quantization Weighted quantization
T H E E N D
57