1. Digital Image Processing and
Analysis - I
Digital image fundamentals
Gizeaddis L. (Ph.D.)
Jimma institute of Technology
School of Biomedical Engineering
2. Outline
• Digital image fundamentals
• Concept of image
• image formation model,
• image sampling and quantization
• Basic relationship between pixels
• singular value representation of discrete images
4. • Image intensity, f(x, y), is proportional to EM energy
radiated/received
• Required f(x, y) is nonzero and finite
• and
• Typical values:
0 ≤ 𝑓(𝑥, 𝑦) ≤ ∞
𝑓(𝑥, 𝑦) = 𝑖(𝑥, 𝑦)𝑟(𝑥, 𝑦)
𝑤ℎ𝑒𝑟𝑒 0 ≤ 𝑖(𝑥, 𝑦) ≤ ∞, incident illumination
0 < r(x,y) < 1, reflected illumination
=
=
snow
,
.
,
.
,
,
i(x,y)
,
93
.
0
paint
wall
flat white
,
8
.
0
material
black
01
0
y)
r(x,
office
commercial
,
lm/m
000
1
night
clear
moon,
full
,
lm/m
01
0
day
cloudy
,
lm/m
000
10
day
sunny
clear
,
lm/m
000
90
2
2
2
2
Concept of image
5. Digital image Representation
• A digital image is the representation of a continuous image
f(x,y) by a 2-d array of discrete samples.
• But the real world is continuous
7. Image sampling and quantization
• An image may be continuous with respect to the x- and y-
coordinates, and also in amplitude.
• When x, y, and the amplitude values are all finite, discrete
quantities, we call the image a digital image.
• To convert it to digital form, we have to sample the
function in both coordinates and in amplitude.
• Digitizing the coordinate values is called sampling.
• Digitizing the amplitude values is called quantization.
8. Image sampling
Continuous image
A scan line from A to B in the
continuous image
To sample this take equally spaced
samples along line AB.
9. Image sampling
• The set of these discrete
locations gives the
sampled function
• In order to form a digital
function, the gray-level
values also must be
converted (quantized) into
discrete quantities.
11. Monochromatic images
• Continuous image function f(x,y)
• arguments - two co-ordinates (x,y) can have any value
• Digital image functions - represented by matrices
• co-ordinates = integer numbers
• Cartesian (horizontal x axis, vertical y axis)
• Monochromatic image function range
• lowest value - black
• highest value - white
• Limited brightness values = grey levels
12. Chromatic images
• Represented by vector not scalar
• Red, Green, Blue (RGB)
• Hue, Saturation, Value (HSV)
• Cyan, Magenta, Yellow (CMY)
Solid color cube
((28)3 = 16,777,216 colors)
20. • The number of distinct gray levels is usually a power of 2
that is, 𝑳 = 𝟐𝑩
where B is the number of bits in the binary representation of the
brightness levels.
• When B>1 we speak of a gray-level image; when B=1 we
speak of a binary image.
• In a binary image there are just two gray levels which can
be referred as “black” and “white” or “0” and “1”.
Gray level images
25. • Image re-sampling or re-sizing operations:-
• zooming, shrinking, rotating, and geometric corrections
• Uses known image data to estimate at the new
locations.
• Different methods:
▪ Nearest neighbor interpolation:- assigns the
intensity of the nearest neighbor to the new
location. Not often used.
Image interpolation
26. ▪ Bilinear interpolation: - uses the four nearest neighbors to
estimate the intensity at a the new location according to
where a, b, c, and d are determined using the four neighbors.
𝑣(𝑥, 𝑦) = 𝑎𝑥 + 𝑏𝑦 + 𝑐𝑥𝑦 + 𝑑
•
o
• •
•
1
• •
o
o
o
o
o
o
o
o
o
o
o
o
o
o •
•
•
o o
o
o
o o
o
o
o
o
o o
2
3 4
?
𝑣(𝑥1, 𝑦1) = 𝑎𝑥1 + 𝑏𝑦1 + 𝑐𝑥1𝑦1 + 𝑑
𝑣(𝑥2, 𝑦2) = 𝑎𝑥2 + 𝑏𝑦2 + 𝑐𝑥2𝑦2 + 𝑑
𝑣(𝑥3, 𝑦3) = 𝑎𝑥3 + 𝑏𝑦3 + 𝑐𝑥3𝑦3 + 𝑑
𝑣(𝑥4, 𝑦4) = 𝑎𝑥4 + 𝑏𝑦4 + 𝑐𝑥4𝑦4 + 𝑑
⇓
𝑎, 𝑏, 𝑐, 𝑑
o - new pixel location
• - old pixel location
Image interpolation
27. ▪ Cubic interpolation: uses the sixteen nearest neighbors to
estimate the intensity at a the new location according to
where the sixteen coefficients aij are determined using the
sixteen equations and in sixteen unknowns using sixteen
nearest neighbors.
• Note:- The expression for the cubic interpolation (N=3)
reduces to the Bilinear interpolation (N =1), i.e.,
N = 1 for Bilinear
N = 3 for Cubic (Adobe Photoshop)
𝑣(𝑥, 𝑦) =
𝑖=0
3
𝑗=0
3
𝑎𝑖𝑗𝑥𝑖
𝑦𝑗
𝑣(𝑥, 𝑦) =
𝑖=0
𝑁
𝑗=0
𝑁
𝑎𝑖𝑗𝑥𝑖𝑦𝑗
28. Basic Relationships Between Pixels
• Neighborhood
• Adjacency
• Connectivity
• Paths
• Regions and boundaries
29. Basic Relationships Between Pixels
• Neighbors of a pixel p at coordinates (x,y)
• 4-neighbors of p, denoted by N4(p):
(x-1, y), (x+1, y), (x,y-1), and (x, y+1).
• 4 diagonal neighbors of p, denoted by ND(p):
(x-1, y-1), (x+1, y+1), (x+1,y-1), and (x-1, y+1).
• 8 neighbors of p, denoted N8(p)
N8(p) = N4(p) U ND(p)
31. Basic Relationships Between Pixels
• Adjacency
Let V be the set of intensity values
• 4-adjacency: Two pixels p and q with
values from V are 4-adjacent if q is in
the set N4(p).
• 8-adjacency: Two pixels p and q with
values from V are 8-adjacent if q is in
the set N8(p).
32. Basic Relationships Between Pixels
• Adjacency
Let V be the set of intensity values
• m-adjacency: Two pixels p and q with values from V are m-
adjacent if
(i) q is in the set N4(p), or
(ii) q is in the set ND(p) and the set N4(p) ∩ N4(q) has no pixels whose values
are from V.
33. Basic Relationships Between Pixels
• Path
• A (digital) path (or curve) from pixel p with coordinates (x0, y0) to pixel q with
coordinates (xn, yn) is a sequence of distinct pixels with coordinates
(x0, y0), (x1, y1), …, (xn, yn)
Where (xi, yi) and (xi-1, yi-1) are adjacent for 1 ≤ i ≤ n.
• Here n is the length of the path.
• If (x0, y0) = (xn, yn), the path is closed path.
34. Basic Relationships Between Pixels
• Connected in S
• Let S represent a subset of pixels in an image.
• Two pixels p with coordinates (x0, y0) and q with coordinates (xn, yn) are
said to be connected in S if there exists a path
(x0, y0), (x1, y1), …, (xn, yn)
Where
∀𝑖, 0 ≤ 𝑖 ≤ 𝑛, (𝑥𝑖, 𝑦𝑖) ∈ 𝑆
35. Basic Relationships Between Pixels
Let S represent a subset of pixels in an image
• For every pixel p in S, the set of pixels in S that are connected to p is called a
connected component of S.
• If S has only one connected component, then S is called Connected Set.
• We call R a region of the image if R is a connected set
• Two regions, Ri and Rj are said to be adjacent if their union forms a
connected set.
• Regions that are not to be adjacent are said to be disjoint.
36. • Boundary (or border)
• The boundary of the region R is the set of pixels in the region that have one
or more neighbors that are not in R.
• If R happens to be an entire image, then its boundary is defined as the set of
pixels in the first and last rows and columns of the image.
• Foreground and background
• An image contains K disjoint regions, Rk, k = 1, 2, …, K. Let Ru denote the
union of all the K regions, and let (Ru)c denote its complement.
• All the points in Ru is called foreground;
• All the points in (Ru)c is called background.
Basic Relationships Between Pixels
37. Distance Measures
• Given pixels p, q and z with coordinates (x, y), (s, t), (u, v)
respectively, the distance function D has following
properties:
a. D(p, q) ≥ 0 [D(p, q) = 0, iff p = q]
b. D(p, q) = D(q, p)
c. D(p, z) ≤ D(p, q) + D(q, z)
38. Distance Measures
The following are the different Distance measures:
a. Euclidean Distance :
De(p, q) = [(x-s)2 + (y-t)2]1/2
b. City Block Distance:
D4(p, q) = |x-s| + |y-t|
c. Chess Board Distance:
D8(p, q) = max(|x-s|, |y-t|)
39. Example
• In the following arrangement of pixels, what’s the value of the
Euclidian and chessboard distance between the circled two
points?
0 0 0 0 0
0 0 1 1 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
40. Singular Value Decomposition (SVD) of
representation of images
• Any real m x n matrix A can be decomposed uniquely:
• U is m x m and column orthonormal (UTU=I)
• D is n x n and diagonal
• σi are called singular values of A
• It is assumed that σ1 ≥ σ2 ≥ … ≥ σn ≥ 0
• V is n x n and orthonormal (VVT=VTV=I)
41. SVD (cont’d)
• If m = n, then:
• U is n x n and orthonormal (UTU=UUT=I)
• D is n x n and diagonal
• V is n x n and orthonormal (VVT=VTV=I)
42. SVD (cont’d)
• The columns of U are eigenvectors of AAT
• The columns of V are eigenvectors of ATA
• If λi is an eigenvalue of ATA (or AAT), then λi = σi
2
for square matrices:
A=PΛP-1
44. SVD properties
• A square (n × n) matrix A is
singular iff at least one of
its singular values σ1, …, σn
is zero.
• The rank of matrix A is
equal to the number of
nonzero singular values σi
45. Matrix “condition”
• SVD gives a way of determining how
singular A is.
• The condition of A measures the degree
of singularity of A:
(ratio of largest singular value to its
smallest singular value)
• A singular matrix is a matrix whose
determinant is 0 and hence it has no
inverse
cond(A)=
46. Example
• For the following matrix, determine
a. The Singular value decomposition of Matrix A
b. From the decomposed values confirm the relation A =
USV’
c. The economy singular value decomposition of A
47. Noise reduction
• The SVD has also applications in digital signal processing,
e.g., as a method for noise reduction.
• The central idea is to let a matrix A represent the noisy
signal, compute the SVD, and then discard small singular
values of A.
• It can be shown that the small singular values mainly
represent the noise, and thus the rank-k matrix Ak
represents a filtered signal with less noise.