Você está na página 1de 81

Digital Image Processing

Digital imaging fundamentals


Massimo Fierro
Department of Computer & Information Communications Engineering
Daegu Catholic University
Daegu, Korea
March 04, 2011
Image size
An image is a multi-dimensional object

2 spatial dimensions: width, height

1 color dimension: number of color channels


Width and height
Width and height are measured in pixel:
bigger size = more imaging space
Color channels
The number of color channels is adimensional.
Common representations:

Red, Green, Blue (display)

Cyan, Yellow, Magenta, K (for printing)

YC
b
C
r
= Luminance, Blue, Red (compression)

N-channels (multi-spectral imaging)

...
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 2/49
Image size
An image is a multi-dimensional object

2 spatial dimensions: width, height

1 color dimension: number of color channels


Width and height
Width and height are measured in pixel:
bigger size = more imaging space
Color channels
The number of color channels is adimensional.
Common representations:

Red, Green, Blue (display)

Cyan, Yellow, Magenta, K (for printing)

YC
b
C
r
= Luminance, Blue, Red (compression)

N-channels (multi-spectral imaging)

...
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 2/49
Image size
An image is a multi-dimensional object

2 spatial dimensions: width, height

1 color dimension: number of color channels


Width and height
Width and height are measured in pixel:
bigger size = more imaging space
Color channels
The number of color channels is adimensional.
Common representations:

Red, Green, Blue (display)

Cyan, Yellow, Magenta, K (for printing)

YC
b
C
r
= Luminance, Blue, Red (compression)

N-channels (multi-spectral imaging)

...
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 2/49
Spatial resolution
Resolution is not size
Resolution is a measure of the smallest detail visible:
higher resolution = more detail
Unit of measure
Resolution only makes sense if you have a unit of measure (e.g. mm)
Common units of resolution

Dots per inch (DPI), common in printing

Lines per inch (LPI), common in device characterization


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 3/49
Spatial resolution
Resolution is not size
Resolution is a measure of the smallest detail visible:
higher resolution = more detail
Unit of measure
Resolution only makes sense if you have a unit of measure (e.g. mm)
Common units of resolution

Dots per inch (DPI), common in printing

Lines per inch (LPI), common in device characterization


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 3/49
Spatial resolution
Resolution is not size
Resolution is a measure of the smallest detail visible:
higher resolution = more detail
Unit of measure
Resolution only makes sense if you have a unit of measure (e.g. mm)
Common units of resolution

Dots per inch (DPI), common in printing

Lines per inch (LPI), common in device characterization


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 3/49
Spatial resolution examples
Resolution of a camera sensor
Canon APS-C sensor (22.3 x 14.9 mm)

Sensor A: 3456 x 2304 (8 Mpixel)

Sensor B: 3888 x 2592 (10.1 Mpixel)


Images in print
35mm size sensor (36x24 mm)
72 DPI 300 DPI
A 722 x 542 mm 173 x 130 mm
B 1372 x 914 mm 329 x 219 mm
Table: Maximum print size according to DPI
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 4/49
Spatial resolution examples
Resolution of a camera sensor
Canon APS-C sensor (22.3 x 14.9 mm)

Sensor A: 3456 x 2304 (8 Mpixel)

Sensor B: 3888 x 2592 (10.1 Mpixel)


Images in print
35mm size sensor (36x24 mm)
72 DPI 300 DPI
A 722 x 542 mm 173 x 130 mm
B 1372 x 914 mm 329 x 219 mm
Table: Maximum print size according to DPI
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 4/49
Changing spatial resolution
Figure: Same image at 1250, 300, 150, 72 dpi (not true on slides)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 5/49
Intensity resolution (color depth)
Denition
Intensity resolution = number of distinguishable colors
Common color depths

1 bit = binary (e.g. black and white)

8-bits = 256 levels (e.g. gray-scale)

3 x 8-bits = 16M colors (256 levels for R, G and B)


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 6/49
Intensity resolution (color depth)
Denition
Intensity resolution = number of distinguishable colors
Common color depths

1 bit = binary (e.g. black and white)

8-bits = 256 levels (e.g. gray-scale)

3 x 8-bits = 16M colors (256 levels for R, G and B)


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 6/49
Changing intensity resolution
(a) (b)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 7/49
Image interpolation
Problem
We have an image and we want to make it bigger (i.e. we want to
increase its width and height).
Missing data
Where do we get the missing data?
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 8/49
Image interpolation
Problem
We have an image and we want to make it bigger (i.e. we want to
increase its width and height).
Missing data
Where do we get the missing data?
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 8/49
Dierent interpolation methods
Nearest neighbor
Use the intensity value of the nearest pixel in the original image
Bilinear interpolation
Use information from the four nearest neighbors
F(x

, y

) = (1 b) [(1 a)F(x, y) + aF(x + 1, y)] +


b [(1 a)F(x, y + 1) + aF(x + 1, y + 1)]
Bicubic interpolation
Use information from the sixteen nearest neighbors
I (x, y) =
3

i =0
3

j =0
a
ij
x
i
y
j
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 9/49
Dierent interpolation methods
Nearest neighbor
Use the intensity value of the nearest pixel in the original image
Bilinear interpolation
Use information from the four nearest neighbors
F(x

, y

) = (1 b) [(1 a)F(x, y) + aF(x + 1, y)] +


b [(1 a)F(x, y + 1) + aF(x + 1, y + 1)]
Bicubic interpolation
Use information from the sixteen nearest neighbors
I (x, y) =
3

i =0
3

j =0
a
ij
x
i
y
j
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 9/49
Dierent interpolation methods
Nearest neighbor
Use the intensity value of the nearest pixel in the original image
Bilinear interpolation
Use information from the four nearest neighbors
F(x

, y

) = (1 b) [(1 a)F(x, y) + aF(x + 1, y)] +


b [(1 a)F(x, y + 1) + aF(x + 1, y + 1)]
Bicubic interpolation
Use information from the sixteen nearest neighbors
I (x, y) =
3

i =0
3

j =0
a
ij
x
i
y
j
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 9/49
(c) 4x4 grid (d) 4x4 and 12x12 grid
(e) Nearest neighbor (f) Bilinear (g) Bicubic
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 10/49
Interpolation examples
(h) 64x64 (i) 128x128 N.Neigh.
(j) 128x128 Bilin. (k) 128x128 Bicub.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 11/49
Interpolation examples
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 12/49
Pixel neighbors
4-neighborhood
Given a pixel p = I (x, y), the 4-neighbors are
N
4
(p) = {I (x + 1, y), I (x 1, y), I (x, y + 1), , I (x, y 1)}
Note
If the p is on the border of the image some of the neighbors will be
outside of the image
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 13/49
Pixel neighbors
Diagonal-neighborhood
Given a pixel p = I (x, y), the diagonal-neighbors are
N
D
(p) = {I (x + 1, y + 1), I (x + 1, y 1), I (x 1, y + 1), , I (x 1, y 1)}
Note
If the p is on the border of the image some of the neighbors will be
outside of the image
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 14/49
Pixel neighbors
8-neighborhood
The 8-neighborhood is given by
N
8
(p) = N
4
N
D
Note
If the p is on the border of the image some of the neighbors will be
outside of the image
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 15/49
Adjacency
4-adjacency
Given two pixels p = 0, q = 0 they are 4-adjacent if
q N
4
(p) or p N
4
(q)
8-adjacency
Given two pixels p = 0, q = 0 they are 8-adjacent if
q N
8
(p) = p N
8
(q)
m-adjacency
Given two pixels p = 0, q = 0 they are m-adjacent if

q N
4
(p), or

q N
D
(p) and all pixels in N
4
(p) N
4
(q) are zero
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 16/49
Paths (curves)
Denition
A path from a pixel p = (x, y) to a pixel q = (s, t) is
a sequence of adjacent pixels {(x
0
, y
0
), (x
1
, y
1
), ..., (x
n
, y
n
)} such that
(x
0
, y
0
) = (x, y) and (x
n
, y
n
) = (s, t)
Closed path
A path is closed if (x, y) = (x
0
, y
0
) = (x
n
, y
n
) = (s, t)
4- 8- and m-paths

A 4-path is computed using 4-adjacency

A 8-path is computed using 8-adjacency

A m-path is computed using m-adjacency


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 17/49
Paths (curves)
Denition
A path from a pixel p = (x, y) to a pixel q = (s, t) is
a sequence of adjacent pixels {(x
0
, y
0
), (x
1
, y
1
), ..., (x
n
, y
n
)} such that
(x
0
, y
0
) = (x, y) and (x
n
, y
n
) = (s, t)
Closed path
A path is closed if (x, y) = (x
0
, y
0
) = (x
n
, y
n
) = (s, t)
4- 8- and m-paths

A 4-path is computed using 4-adjacency

A 8-path is computed using 8-adjacency

A m-path is computed using m-adjacency


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 17/49
Paths (curves)
Denition
A path from a pixel p = (x, y) to a pixel q = (s, t) is
a sequence of adjacent pixels {(x
0
, y
0
), (x
1
, y
1
), ..., (x
n
, y
n
)} such that
(x
0
, y
0
) = (x, y) and (x
n
, y
n
) = (s, t)
Closed path
A path is closed if (x, y) = (x
0
, y
0
) = (x
n
, y
n
) = (s, t)
4- 8- and m-paths

A 4-path is computed using 4-adjacency

A 8-path is computed using 8-adjacency

A m-path is computed using m-adjacency


M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 17/49
Connected components
Connection
Let S be a subset of pixels in the image.
Two pixels p, q are connected in S if there is a path between them made
entirely of pixels in S
Connected component
For any pixel p S, the set of pixels connected to it are called a
connected component of S
Connected set
If in S there is just one connected component, then S is a connected set
or region.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 18/49
Connected components
Connection
Let S be a subset of pixels in the image.
Two pixels p, q are connected in S if there is a path between them made
entirely of pixels in S
Connected component
For any pixel p S, the set of pixels connected to it are called a
connected component of S
Connected set
If in S there is just one connected component, then S is a connected set
or region.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 18/49
Connected components
Connection
Let S be a subset of pixels in the image.
Two pixels p, q are connected in S if there is a path between them made
entirely of pixels in S
Connected component
For any pixel p S, the set of pixels connected to it are called a
connected component of S
Connected set
If in S there is just one connected component, then S is a connected set
or region.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 18/49
Connected components
Connection
Let S be a subset of pixels in the image.
Two pixels p, q are connected in S if there is a path between them made
entirely of pixels in S
Connected component
For any pixel p S, the set of pixels connected to it are called a
connected component of S
Connected set
If in S there is just one connected component, then S is a connected set
or region.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 18/49
Examples
(l) Set S
1
(m) Connected compo-
nents in S
1
(n) Set S
2
(o) Region in S
2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 19/49
Relationships between regions
Adjacent regions
Two regions R
i
, R
j
, in the same image, are adjacent if R
i
R
j
is a region
itself.
Disjoint regions
Two regions R
i
, R
j
, in the same image, are disjoint if they are not
adjacent.
Choice of adjacency
The choice of the adjacency method is extremely important!
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 20/49
Relationships between regions
Adjacent regions
Two regions R
i
, R
j
, in the same image, are adjacent if R
i
R
j
is a region
itself.
Disjoint regions
Two regions R
i
, R
j
, in the same image, are disjoint if they are not
adjacent.
Choice of adjacency
The choice of the adjacency method is extremely important!
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 20/49
Relationships between regions
Adjacent regions
Two regions R
i
, R
j
, in the same image, are adjacent if R
i
R
j
is a region
itself.
Disjoint regions
Two regions R
i
, R
j
, in the same image, are disjoint if they are not
adjacent.
Choice of adjacency
The choice of the adjacency method is extremely important!
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 20/49
Relationships between regions
Adjacent regions
Two regions R
i
, R
j
, in the same image, are adjacent if R
i
R
j
is a region
itself.
Disjoint regions
Two regions R
i
, R
j
, in the same image, are disjoint if they are not
adjacent.
Choice of adjacency
The choice of the adjacency method is extremely important!
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 20/49
Distance measures
Denition
A function D(p, q), where p and q are points in an image, is called a
distance function or distance metric if all the following conditions are
veried

D(p, q) 0

D(p, q) = D(q, p)

D(p, z) D(p, q) + D(q, z)


Euclidean distance
Given p = (p
x
, p
y
) and q = (q
x
, q
y
) the Euclidean distance is
D
e
(p, q) =

(p
x
q
x
)
2
+ (p
y
q
y
)
2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 21/49
Distance measures
Denition
A function D(p, q), where p and q are points in an image, is called a
distance function or distance metric if all the following conditions are
veried

D(p, q) 0

D(p, q) = D(q, p)

D(p, z) D(p, q) + D(q, z)


Euclidean distance
Given p = (p
x
, p
y
) and q = (q
x
, q
y
) the Euclidean distance is
D
e
(p, q) =

(p
x
q
x
)
2
+ (p
y
q
y
)
2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 21/49
Distance measures
D
4
distance (alias Manhattan or city block)
Given p = (p
x
, p
y
) and q = (q
x
, q
y
) the Manhattan distance is
D
4
(p, q) = |p
x
q
x
| +|p
y
q
y
|
D
8
distance (alias chessboard)
Given p = I (p
x
, p
y
) and q = I (q
x
, q
y
) the chessboard distance is
D
8
(p, q) = max(|p
x
q
x
|, |p
y
q
y
|)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 22/49
Distance measures
D
4
distance (alias Manhattan or city block)
Given p = (p
x
, p
y
) and q = (q
x
, q
y
) the Manhattan distance is
D
4
(p, q) = |p
x
q
x
| +|p
y
q
y
|
D
8
distance (alias chessboard)
Given p = I (p
x
, p
y
) and q = I (q
x
, q
y
) the chessboard distance is
D
8
(p, q) = max(|p
x
q
x
|, |p
y
q
y
|)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 22/49
Matrix vs Array (point by point) operations
Given two matrices a =

a
1,1
a
1,2
a
2,1
a
2,2

and b =

b
1,1
b
1,2
b
2,1
b
2,2

Array product
The array product of a and b is
ab =

a
1,1
a
1,2
a
2,1
a
2,2

b
1,1
b
1,2
b
2,1
b
2,2

a
1,1
b
1,1
a
1,2
b
1,2
a
2,1
b
2,1
a
2,2
b
2,2

Matrix product
The matrix product of a and b is
ab =

a
1,1
a
1,2
a
2,1
a
2,2

b
1,1
b
1,2
b
2,1
b
2,2

a
1,1
b
1,1
+ a
1,2
b
2,1
a
1,1
b
1,2
+ a
1,2
b
2,2
a
2,1
b
1,1
+ a
2,2
b
2,1
a
2,1
b
1,2
+ a
2,2
b
2,2

M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 23/49
Matrix vs Array (point by point) operations
Given two matrices a =

a
1,1
a
1,2
a
2,1
a
2,2

and b =

b
1,1
b
1,2
b
2,1
b
2,2

Array product
The array product of a and b is
ab =

a
1,1
a
1,2
a
2,1
a
2,2

b
1,1
b
1,2
b
2,1
b
2,2

a
1,1
b
1,1
a
1,2
b
1,2
a
2,1
b
2,1
a
2,2
b
2,2

Matrix product
The matrix product of a and b is
ab =

a
1,1
a
1,2
a
2,1
a
2,2

b
1,1
b
1,2
b
2,1
b
2,2

a
1,1
b
1,1
+ a
1,2
b
2,1
a
1,1
b
1,2
+ a
1,2
b
2,2
a
2,1
b
1,1
+ a
2,2
b
2,1
a
2,1
b
1,2
+ a
2,2
b
2,2

M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 23/49
Linear vs Non-linear operations
Consider operator H such that, given the image f (x, y) as input, it
produces the image g(x, y) as output
H [f (x, y)] = g(x, y)
Linear operations
H is said to be a linear operator if it satises the additivity property, i.e.
H [a
i
f
i
(x, y) + a
j
f
j
(x, y)] = [a
i
f
i
(x, y)] + [a
j
f
j
(x, y)]
= a
i
g
i
(x, y) + a
j
g
j
(x, y)
Non-linear operations
H is said to be a non-linear operator if the additivity property is not
satised
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 24/49
Linear vs Non-linear operations
Consider operator H such that, given the image f (x, y) as input, it
produces the image g(x, y) as output
H [f (x, y)] = g(x, y)
Linear operations
H is said to be a linear operator if it satises the additivity property, i.e.
H [a
i
f
i
(x, y) + a
j
f
j
(x, y)] = [a
i
f
i
(x, y)] + [a
j
f
j
(x, y)]
= a
i
g
i
(x, y) + a
j
g
j
(x, y)
Non-linear operations
H is said to be a non-linear operator if the additivity property is not
satised
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 24/49
Linear vs Non-linear operations
Consider operator H such that, given the image f (x, y) as input, it
produces the image g(x, y) as output
H [f (x, y)] = g(x, y)
Linear operations
H is said to be a linear operator if it satises the additivity property, i.e.
H [a
i
f
i
(x, y) + a
j
f
j
(x, y)] = [a
i
f
i
(x, y)] + [a
j
f
j
(x, y)]
= a
i
g
i
(x, y) + a
j
g
j
(x, y)
Non-linear operations
H is said to be a non-linear operator if the additivity property is not
satised
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 24/49
Arithmetic Operations
Denition
Arithmetic operations between images are array operations and they can
be written as
s(x, y) = f (x, y) + g(x, y)
d(x, y) = f (x, y) g(x, y)
p(x, y) = f (x, y) g(x, y)
v(x, y) = f (x, y) g(x, y)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 25/49
Arithmetic Operations
Denition
Arithmetic operations between images are array operations and they can
be written as
s(x, y) = f (x, y) + g(x, y)
d(x, y) = f (x, y) g(x, y)
p(x, y) = f (x, y) g(x, y)
v(x, y) = f (x, y) g(x, y)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 25/49
Frequent use of image summation: image denoising
Assumptions
Suppose that we have a clean image f (x, y) and some non-correlated
noise (x, y), then g(x, y) = f (x, y) +(x, y) is a noise corrupted image.
Average
If we have multiple noisy images g
i
(x, y), we can obtain f (x, y) by using
the average operation
g(x, y) =
1
K
K

i =1
g
i
(x, y)
Then
E { g(x, y)} = f (x, y)

2
g(x,y)
=
1
K

2
(x,y)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 26/49
Frequent use of image summation: image denoising
Assumptions
Suppose that we have a clean image f (x, y) and some non-correlated
noise (x, y), then g(x, y) = f (x, y) +(x, y) is a noise corrupted image.
Average
If we have multiple noisy images g
i
(x, y), we can obtain f (x, y) by using
the average operation
g(x, y) =
1
K
K

i =1
g
i
(x, y)
Then
E { g(x, y)} = f (x, y)

2
g(x,y)
=
1
K

2
(x,y)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 26/49
Image averaging example
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 27/49
Frequent use of image subtraction: visibility enhancement
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 28/49
Frequent use of image multiplication (division): shading
correction
Description
Sometimes the lighting in a scene may be non-uniform, or the camera
lens may present the vignetting phenomenon. This can be easily
corrected if we can model the shading pattern.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 29/49
Note on data range
Data range problem
The usual data range for 8-bit images is [0, 255]. If we perform
arithmetics on such images, we may end up with values outside that
range (i.e. 15 200 = 175)
Data range solution
After performing arithmetics you should do the following
f
m
= f min(f )
f
s
= K

f
m
max(f
m
)

M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 30/49
Note on data precision
Data precision problem
Especially when performing division, you might want better precision
than available by using integer operations.
Data precision solution
1. Convert the data to oating-point
2. Perform arithmetics
3. Convert the data back to integer
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 31/49
Sets
Denition
A set is a collection of elements and it is indicated by a list of all
elements, or a specication of the element characteristics, e.g.
A = {1, 2, 4, 7, 10, 52}
A = {w|w = 2k + 1}
Set membership
If an element a is in set A, then we write
a A
Similarly, if a is not in set A, then we write
a / A
The empty set is denoted by the symbol
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 32/49
Sets
Denition
A set is a collection of elements and it is indicated by a list of all
elements, or a specication of the element characteristics, e.g.
A = {1, 2, 4, 7, 10, 52}
A = {w|w = 2k + 1}
Set membership
If an element a is in set A, then we write
a A
Similarly, if a is not in set A, then we write
a / A
The empty set is denoted by the symbol
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 32/49
Set operations
Union and intersection
The union of sets A and B is
W = A B = {w A or w B}
The intersection of sets A and B is
W = A B = {w A and w B}
Complement and dierence
The complement of a set A is
A
C
= {w|w / A}
The dierence between two sets A and B is
A B = {w A, w / B} = A B
C
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 33/49
Set operations
Union and intersection
The union of sets A and B is
W = A B = {w A or w B}
The intersection of sets A and B is
W = A B = {w A and w B}
Complement and dierence
The complement of a set A is
A
C
= {w|w / A}
The dierence between two sets A and B is
A B = {w A, w / B} = A B
C
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 33/49
Logical operations
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 34/49
Spatial operations
Spatial (image space) operations are divided in three kinds

Single pixel

Neighborhood

Geometric spatial transforms


Single pixel operations
Also known as pixel-by-pixel or pixel-wise operations, they are performed
on every pixel transforming it according to a function
O(x, y) = T(I (x, y))
where O(x, y) is the new intensity and I (x, y) the original intensity value.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 35/49
Spatial operations
Spatial (image space) operations are divided in three kinds

Single pixel

Neighborhood

Geometric spatial transforms


Single pixel operations
Also known as pixel-by-pixel or pixel-wise operations, they are performed
on every pixel transforming it according to a function
O(x, y) = T(I (x, y))
where O(x, y) is the new intensity and I (x, y) the original intensity value.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 35/49
Spatial operations
Neighborhood operations
Also known as local operations, they are performed on a sliding
window (i.e. an area that is centered on one pixel at a time)
O(x, y) = T(W(x, y))
where W(x, y) is the set of pixels intensities in the window centered on
pixel (x, y), m is the window width and n is the window height
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 36/49
Neighborhood operation example
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 37/49
Spatial operations
Geometric spatial transformations
Geometric transformations consist of two steps
1. Spatial transformation of coordinates
2. Intensity interpolation
Transformation of coordinates
The transformation of coordinates can be expressed as
(x, y) = T{(v, w)}
where (v, w) are the original coordinates and (x, y) the transformed
ones.
Example: (x, y) = (
v
2
,
w
2
) down-scales the image by a factor 2.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 38/49
Spatial operations
Geometric spatial transformations
Geometric transformations consist of two steps
1. Spatial transformation of coordinates
2. Intensity interpolation
Transformation of coordinates
The transformation of coordinates can be expressed as
(x, y) = T{(v, w)}
where (v, w) are the original coordinates and (x, y) the transformed
ones.
Example: (x, y) = (
v
2
,
w
2
) down-scales the image by a factor 2.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 38/49
Geometric spatial transformations
Ane transform
The ane transform is a kind of generic transform that can perform
the following operations at the same time

Translation

Rotation

Scaling

Shearing
The ane transform has the following form

x y 1

v w 1

T =

v w 1

t
1,1
t
1,2
0
t
2,1
t
2,2
0
t
3,1
t
3,2
1

where x = vt
1,1
+ wt
2,1
+ t
3,1
and y = vt
1,2
+ wt
2,2
+ t
3,2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 39/49
Geometric spatial transformations
Ane transform
The ane transform is a kind of generic transform that can perform
the following operations at the same time

Translation

Rotation

Scaling

Shearing
The ane transform has the following form

x y 1

v w 1

T =

v w 1

t
1,1
t
1,2
0
t
2,1
t
2,2
0
t
3,1
t
3,2
1

where x = vt
1,1
+ wt
2,1
+ t
3,1
and y = vt
1,2
+ wt
2,2
+ t
3,2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 39/49
Ane transform usage
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 40/49
Image registration
Denition
Image registration is that process that allows to compute the
transformation (usually ane) that separates two images. It is used in
panorama stitching, super-resolution, etc...
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 41/49
Vector and matrix operations
A pixel with multiple values is a vector
Imagine a pixel with red, green and blue values: we can write it as
z =

r
g
b

z
1
z
2
z
3

An image with vector valued pixels is a 3D matrix


If our image has width M and height N, then we can write it as an
M N 3 matrix.
Distance not only in image space
If we want we can compute distances also in color space, or a mix of
image and color space. E.g. the generic formula for the Euclidean
distance (vector norm) is
||b a|| = D(a, b) =

(a
1
b
1
)
2
+ (a
2
b
2
)
2
+ (a
n
b
n
)
2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 42/49
Vector and matrix operations
A pixel with multiple values is a vector
Imagine a pixel with red, green and blue values: we can write it as
z =

r
g
b

z
1
z
2
z
3

An image with vector valued pixels is a 3D matrix


If our image has width M and height N, then we can write it as an
M N 3 matrix.
Distance not only in image space
If we want we can compute distances also in color space, or a mix of
image and color space. E.g. the generic formula for the Euclidean
distance (vector norm) is
||b a|| = D(a, b) =

(a
1
b
1
)
2
+ (a
2
b
2
)
2
+ (a
n
b
n
)
2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 42/49
Vector and matrix operations
A pixel with multiple values is a vector
Imagine a pixel with red, green and blue values: we can write it as
z =

r
g
b

z
1
z
2
z
3

An image with vector valued pixels is a 3D matrix


If our image has width M and height N, then we can write it as an
M N 3 matrix.
Distance not only in image space
If we want we can compute distances also in color space, or a mix of
image and color space. E.g. the generic formula for the Euclidean
distance (vector norm) is
||b a|| = D(a, b) =

(a
1
b
1
)
2
+ (a
2
b
2
)
2
+ (a
n
b
n
)
2
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 42/49
Vector and matrix operations
Linear transformations
When using matrix notation it is very easy to express linear
transformations
w = A(b a)
where A has size m n and w, a, b are all column vectors of size n 1
Image as a vector
Another useful representation of an image is that of a MN 1 vector
(assuming one color channel) where each row is a group of N elements of
the vector. Many linear transformations can then be expressed as
g = Hh +n
where H has size MN MN and represents the linear process, f is a
MN 1 vector representing the input image, n is a MN 1 vector
representing noise and g is the output image in vector form. all column
vectors of size n 1
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 43/49
Vector and matrix operations
Linear transformations
When using matrix notation it is very easy to express linear
transformations
w = A(b a)
where A has size m n and w, a, b are all column vectors of size n 1
Image as a vector
Another useful representation of an image is that of a MN 1 vector
(assuming one color channel) where each row is a group of N elements of
the vector. Many linear transformations can then be expressed as
g = Hh +n
where H has size MN MN and represents the linear process, f is a
MN 1 vector representing the input image, n is a MN 1 vector
representing noise and g is the output image in vector form. all column
vectors of size n 1
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 43/49
Space transforms
Going into outer space...
There are many dierent space in which image analysis can be
performed. The most well known is the Fourier space, which lies in the
frequency domain instead of the spatial domain.
Foorward T(u, v) transforms
A particular class of 2D linear transforms, known as T(u, v) can be
expressed as
T(u, v) =
M1

x=0
N1

y=0
f (x, y)r (x, y, u, v)
where f (x, y) is the input image, r (x, y, u, v) is called the forward
transformation kernel and 0 u M 1, 0 v N 1. u, v are called
the tranform variables.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 44/49
Space transforms
Inverse T(u, v) transforms
f (x, y) =
M1

x=0
N1

y=0
T(u, v)s(x, y, u, v)
where s(x, y, u, v) is called the inverse transformation kernel and
0 u M 1, 0 v N 1.
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 45/49
Separable and symmetric transforms
Separable kernel
A kernel is said to be separable if
r (x, y, u, v) = r
1
(x, u)r
2
(y, v)
Symmetric kernel
A separable kernel is said to be symmetric if
r (x, y, u, v) = r
1
(x, u)r
1
(y, v)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 46/49
Fourier Transform
Forward transform
r (x, y, u, v) = e
i 2(
ux
M
+
vy
N
)
Reverse transform
s(x, y, u, v) =
1
MN
e
i 2(
ux
M
+
vy
N
)
i or j
The book (written by an engineer) uses the letter j to indicate

1, but
I will use the letter i , because it is traditional to mathematics.
Other transforms
There are many other transforms expressed in such form as the Walsh,
Hadamard, Haar, discrete cosine, etc...
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 47/49
Probabilistic methods
Probability of an intensity value in an image
p(z
k
) =
n
k
MN
where z
k
is the k-th intensity level in the image, n
k
is the number of
pixels with intensity k and MN is the total number of pixels.
Sum of probabilities
L

k=1
p(z
k
) = 1
where L is the number of possible levels
Image average (mean): rst moment
m =
L

k=1
z
k
p(z
k
)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 48/49
Probabilistic methods
Image variance: second moment

2
=
L

k=1
(z
k
m)
2
p(z
k
)
n-th statistical moment

n
(z) =
L

k=1
(z
k
m)
n
p(z
k
)
M. Fierro, Daegu Catholic University Digital Image Processing, Digital imaging fundamentals 49/49

Você também pode gostar