CSE 7448 – Image Processing
Chapter 2. Digital Image Fundamentals
Nov 2019
Prof. Chung/Worku J. (PhD)
Introduction
► Contents of Book
1. Introduction
2. Digital Image Fundamentals
3. Intensity Transformations and Spatial Filtering
4. Filtering in the Frequency Domain
5. Image Restoration and Reconstruction
6. Color Image processing
7. Wavelets and Multiresolution Processing
8. Morphological Image processing
9. Image Segmentation
2
Introduction
Last week
How images are formed in human eyes
How images are formed with cameras (EMS)
Image acquisition
Simple image formation model
Sampling and quantization
summary
3
Introduction
Outline
DI representation
Spatial and Intensity resolution
Interpolation
Pixel relation
Basic
Mathematical operation
Summary
4
2.8 Representing Digital Images
► Therepresentation of an M×N numerical
array in MATLAB
f (1,1) f (1, 2) ... f (1, N )
f (2,1) f (2, 2) ... f (2, N )
f ( x, y )
... ... ... ...
f ( M ,1) f ( M , 2) ... f (M , N )
5
2.8 Representing Digital Images
► DI are stored in bits. Equal amount of bits are assigned to each
pixels for an image.
► We call it bit per pixel (bpp).
► 1bpp = 2color or shade of color or discrete intensity level. Just
black and white (0 for black and 1 for white)
► 2bpp=4 colors.
► .
► .
► n bpp= 2n colors or shade of colors
6
2.8 Representing Digital Images
L=2n is called discrete intensity interval and ranges [0, L-1].
Note: the number b of bits required to store a M × N digitized
image
b=M×N×n
Where n is the number of bit used per each pixel
7
2.8 Representing Digital Images
8
Exercise: How many bits are required to store two
images of size each 512x512
a) if 8 bit is used pp
b) if 4 bit is used pp
c) if 1 bit is used pp
Which bit demand higher storage?
9
Experiment 1:
Visualize image in Matlab, determine the number of row
and column, identify intensity, pixel value, dimension of
the image, color of the image, etc
10
2.9 Spatial and Intensity Resolution
►Spatial resolution
A measure of the smallest discernible detail in an image
stated with line pairs per unit distance, dots (pixels) per
unit distance, dots per inch (dpi), 300dpi, 600 dpi
Display, Image:
640 x 480 (image), 1,000,000 pixels(camera)
►Intensity resolution
The smallest discernible change in intensity level stated with
1bit=2level, 2 bits=4level , 8 bits=256 level, 12 bits=1024
level, 16 bits, etc.
12
2.9 Spatial and Intensity Resolution
300 dpi
1250
dpi
72 dpi
150 dpi
13
2.9 Spatial and Intensity Resolution
14
Experiment 2: Exercise
►Select any appropriate image and apply
intensity resolution and spatial resolution
15
2.10 Image Interpolation
► Interpolation— Process of using known data to
estimate unknown values
e.g., zooming, shrinking, rotating, and geometric correction
► Interpolation (sometimes called resampling) —
an imaging method to increase (or decrease) the number
of pixels in a digital image.
Some digital cameras use interpolation to produce a larger image than
the sensor captured or to create digital zoom
16
2.10 Image Interpolation:
a) Nearest Neighbor Interpolation
f1(x2,y2) = f(x1,y1)
f(round(x2), round(y2))
=f(x1,y1)
f1(x3,y3) =
f(round(x3), round(y3))
=f(x1,y1)
17
2.10 Image Interpolation:
b) Bilinear Interpolation
v(x,y) = ax + by + cxy + d
(x,y)
18
2.10 Image Interpolation:
c) Bi-cubic Interpolation
► The intensity value assigned to point (x,y) is obtained by
the following equation
3 3
f 3 ( x, y ) aij x y i j
i 0 j 0
► Has sixteen coefficients are determined by using the
sixteen nearest neighbors.
19
2.10Image Interpolation:
c) Bi-cubic Interpolation
► Better perform than Bi-linear and nearest neighbor.
► Has more computational complexity than the two
interpolation
► Is the standard used in commercials image editing
program Adobe Photoshop and Corel Photopaint .
20
2.10 Image Interpolation:
c) Bi-cubic Interpolation
► More coefficient can be used for better results, but severe
from computational burden and storage.
► Other methods such as spline interpolation and wavelet is
also used with better performance than Bi-Cubic
interpolation.
21
1250 dpi image(3962 x 2812)
- (shrinking)
72 dpi image(213 x 162)
(zooming back)
1250 dpi
1250 dpi image -
150 dpi image (shrinking)
1250 dpi (zooming back)
25
Examples: Interpolation
26
Examples: Interpolation
27
Examples: Interpolation
28
Examples: Interpolation
29
Examples: Interpolation
30
Examples: Interpolation
31
Examples: Interpolation
32
Examples: Interpolation
33
Experiment 3:
Apply Neighbor, Bi-linear, cubic and spline
interpolation on Lena Image ([Link])
34
2.11 Basic Relationships Between Pixels
► Neighborhood
► Adjacency
► Connectivity
► Paths
► Regions and boundaries
35
2.11 Basic Relationships Between Pixels
a) Neighbor of pixel
► 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) (x-1, y-1) (x, y-1) (x+1, y-1)
N8(p) = N4(p) U ND(p)
(x-1, y) (x,y) (x+1, y)
(x-1, y+1) (x, y+1) (x+1, y+1)
36
2.11 Basic Relationships Between Pixels
b) Adjacency, connectivity, regions and Boundaries
► Adjacency
Let V be the set of intensity values ex. V={1, 2}
4-adjacency: Two pixels p and q with values from V are 4-
adjacent if q is in the set N4(p). 0 0 0
0 2 1
0 0 0
8-adjacency: Two pixels p and q with values from V are 8-
adjacent if q is in the set N8(p). 0 0 0
0 2 0
0 0 2
37
2.11 Basic Relationships Between Pixels
b) Adjacency, connectivity, regions and Boundaries
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.
38
2.11 Basic Relationships Between Pixels
b) Adjacency, connectivity, regions and Boundaries
► Path
A (digital) path (or curve) from pixel p with coordinates (x 0, 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.
We can define 4-, 8-, and m-paths based on the type of adjacency used.
39
Examples: Adjacency and Path
V = {1, 2}
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
40
Examples: Adjacency and Path
V = {1, 2}
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
8-adjacent
41
Examples: Adjacency and Path
V = {1, 2}
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
8-adjacent m-adjacent
42
Examples: Adjacency and Path
V = {1, 2}
0 1,1 1
1,2 11,3 0 1 1 0 1 1
0 2,1 2
2,2 02,3 0 2 0 0 2 0
0 3,1 0
3,2 13,3 0 0 1 0 0 1
8-adjacent m-adjacent
The 8-path from (1,3) to (3,3): The m-path from (1,3) to (3,3):
(i) (1,3), (1,2), (2,2), (3,3) (1,3), (1,2), (2,2), (3,3)
(ii) (1,3), (2,2), (3,3)
43
2.11 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 i, 0 i n, ( xi , yi ) S
44
2.11 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.
45
2.11 Basic Relationships Between Pixels
► 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.
46
Question 1
► In the following arrangement of pixels, are the two
regions (of 1s) adjacent? (if 8-adjacency is used)
1 1 1
Region 1
1 0 1
0 1 0
Region 2
0 0 1
1 1 1
1 1 1
47
Question 2
► In the following arrangement of pixels, are the two
parts (of 1s) adjacent? (if 4-adjacency is used)
1 1 1
Part 1
1 0 1
0 1 0
Part 2
0 0 1
1 1 1
1 1 1
48
► In the following arrangement of pixels, the two
regions (of 1s) are disjoint (if 4-adjacency is used)
1 1 1
Region 1
1 0 1
0 1 0
Region 2
0 0 1
1 1 1
1 1 1
49
► In the following arrangement of pixels, the two
regions (of 1s) are disjoint (if 4-adjacency is used)
1 1 1
foreground
1 0 1
0 1 0
background
0 0 1
1 1 1
1 1 1
50
Question 3
► In the following arrangement of pixels, the circled
point is part of the boundary of the 1-valued pixels
if 8-adjacency is used, true or false?
0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 1 1 1 1
0 1 1 1 1
0 0 0 0 0
51
Question 3 (answer)
► In the following arrangement of pixels, the circled point is part of
the boundary of the 1-valued pixels if 4-adjacency is used, true or
false?
0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 1 1 1 1
(4-adjacency) 0 1 1 1 1
0 0 0 0 0
52
Question 4
► In the following arrangement of pixels, the circled
point is part of the boundary of the 1-valued pixels
if 4-adjacency is used, true or false?
0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
53
2.11 Basic Relationships Between Pixels
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]
z
b. D(p, q) = D(q, p)
c. D(p, z) ≤ D(p, q) + D(q, z)
p q
54
2.11 Basic Relationships Between Pixels
Distance Measures
1.4 1 1.4
2 1 0 1 2
1.4 1 1.4
55
Question 5
► In the following arrangement of pixels, what’s the
value of the 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
56
Question 6
► In the following arrangement of pixels, what’s the
value of the city-block 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
57
Question 7
► In the following arrangement of pixels, what’s the
value of the length of the m-path 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
58
Question 8
► In the following arrangement of pixels, what’s the
value of the length of the m-path between the
circled two points?
0 0 0 0 0
0 0 1 1 0
0 0 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
59
2.12 Introduction to Mathematical Operations
in DIP
► Array vs. Matrix Operation
a11 a12 b11 b12
A B
a21 a22 b b
21 22
Array
product
operator
a11b11 a12b12 Array product
A .* B
a21b21 a22b22
Matrix
product
operator
a11b11 a12b21 a11b12 a12b22 Matrix product
A*B
a21b11 a22b21 a21b12 a22b22
60
2.12 Introduction to Mathematical Operations
in DIP
► Linear vs. Nonlinear Operation:
H is operator, f(x,y) is input image, g(x,y) is output image.
H f ( x , y ) g ( x, y )
H ai f i ( x, y ) a j f j ( x, y )
Additivity
H ai fi ( x, y ) H a j f j ( x, y )
ai H f i ( x, y ) a j H f j ( x, y ) Homogeneity
ai gi ( x, y ) a j g j ( x, y )
H is said to be a linear operator;
H is said to be a nonlinear operator if it does not meet the above
qualification.
61
2.12 Introduction to Mathematical Operations
in DIP
Arithmetic Operations
► Arithmetic operations between images are array
operations. The four arithmetic operations are denoted
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)
62
Example: Addition of Noisy Images for Noise Reduction
Noiseless image: f(x,y)
Noise: n(x,y) (at every pair of coordinates (x,y), the noise is uncorrelated and
has zero average value)
Corrupted image: g(x,y)
g(x,y) = f(x,y) + n(x,y)
Reducing the noise by adding a K set of noisy images, {gi(x,y)}
K
1
g ( x, y )
K
g ( x, y )
i 1
i
63
Image Averaging
66
Image Subtraction
(b): X-ray images captured after injection of the contrast medium into
the bloodstream (iodine medium: Halogen – dark blue colored) 68
An Example of Image Multiplication
69
Experiment: show an example of operation
applied on image using matlab? i.e addition,
subtraction, multiplication and division
70
2.12 Introduction to Mathematical Operations
in DIP
Set and Logical Operations
71
2.12 Introduction to Mathematical Operations
in DIP
Set and Logical Operations
► Let A be the elements of a gray-scale image
The elements of A are triplets of the form (x, y, z), where
x and y are spatial coordinates and z denotes the intensity
at the point (x, y).
A {( x, y, z ) | z f ( x, y )}
►
72
2.12 Introduction to Mathematical Operations
in DIP
Set and Logical Operations
► The union of two gray-scale images (sets) A and B is
defined as the set
A B {max(a, b) | a A, b B}
z
73
2.12 Introduction to Mathematical Operations in DIP
Set and Logical Operations
A= B = AC C = A U 3 Avg(A)
Original image = { (x,y, 255-z)| 74
(x,y,z) ϵ A}
► Summary:
DI representation
Interpolation
Relation between pixels
Some basic Operation
75