1. Digital Image Processing
Mithun kumar kar
Department of Electrical Engineering
BALASORE COLLEGE OF ENGINEERING AND TECHNOLOGY, BALASORE
July 14, 2020
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 1 / 26
2. Overview
1 Fundamentals of Digital Image Processing
2 Representation of digital image
3 Intensity Transformation
4 Relation between pixels
5 Image Histogram
6 Fundamentals of Spatial Filtering
7 Frequency domain representation
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 2 / 26
3. Fundamentals of Digital Image Processing
Image processing involves changing the nature of an image in order to
either
improve its pictorial information for human interpretation.
render it more suitable for autonomous machine perception.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 3 / 26
4. Definitions
An Image may be defined as a two dimensional function f (x, y) where
x and y are spatial coordinates and the amplitude of ’f ’ at any pair of
coordinates (x,y) is called the intensity value or gray level of the
image at that point.
An image is called a digital image when the spatial coordinates x, y
and the intensity value of ’f’ all are finite and discrete quantities.
A digital image is an array of real or complex numbers represented by
a finite number of bits.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 4 / 26
5. Representation of digital image
A digital image is formed by sampling and quantization containing M
rows and N columns.
f (x, y) =
f (0, 0) f (0, 1) . . . f (0, N − 1)
f (1, 0)
...
f (1, 1) · · ·
...
f (1, N − 1)
...
f (M − 1, 0) f (M − 1, 0) · · · f (M − 1, N − 1)
Each element of this matrix is called an image element or picture
element or pixels.
The origin of a digital image is at the top left with the + x axis
extending downward and the + y axis extending to the right.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 5 / 26
6. Representation of digital image
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 6 / 26
7. Types of digital image
An Image may be classified in to three types
Color Image
Grey Image
Binary Image
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 7 / 26
11. Image file format
Image file format is an algorithm or a method used to store and display an
image. Some of the popular image file formats are
JPEG (Joint Photographic Expert Group)
PNG (Portable Network Graphics)
TIFF (Tagged Image File Format)
GIF (Graphics Interchange Format)
BMP (BitMap file format)
PSD (Photoshop’s default format)
EPS (Encapsulated PostScript)
SVG (Scalable Vector Graphics)
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 11 / 26
12. Neighbors of a pixel
A pixel p at coordinates (x, y) has four horizontal and vertical
neighbors whose coordinates are given by
(x + 1, y), (x − 1, y), (x, y + 1), (x, y − 1). These set of pixels called
4 − neighbors of p and is denoted by N4(p). Each pixel is at a unit
distance from (x, y).
The four diagonal neighbors of p have coordinates
(x + 1, y + 1), (x + 1, y − 1), (x − 1, y + 1), (x − 1, y − 1). These set
of pixels called 8 − neighbors of p and is denoted by ND(p)
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 12 / 26
13. Adjacency,Connectivity
Let V be the set of gray level values used to define adjacency. For example
in a 8 bit gray scale image V ranges from 0 to 255.
4-adjacency – Two pixels p and q with values from V are 4-adjacent if
q is in N4(p)
8-adjacency – Two pixels p and q with values from V are 8-adjacent if
q is in N8(p)
m-adjacency –Two pixels p and q with values from V are 8-adjacent if
i) q is in N4(p) ii)q is in N8(p) and the set N4(p) ∩ N4(q) has no
pixels whose values are from V.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 13 / 26
14. Regions and Boundaries
Let S represent a subset of pixels in an image.
Two pixels p and q are said to be connected in S if there exist a path
between them consisting entirely pixels in S. For any pixel p in S , the
set of pixels connected to it in S is called a connected component of
S. If it has one connected component then the set S is called a
connected set.
Let R be a subset of pixels in an image, then we can take R as a
region of the image if R is a connected set.
Two regions Ri and Rj are said to be adjacent if their union form a
connected set.
The boundary of a region R is the set of points that are adjacent to
the points in the complement of R.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 14 / 26
15. Regions and Boundaries
Edges - The edge in an image is a local concept that is based on a
measure of intensity-level discontinuity at a point.
Image resolution - Image has two types of resolution, one is spatial
resolution and another is intensity resolution.
Spatial resolution is expressed by pixels per unit distance(dpi).
Intensity resolution refers to the smallest discernible change in its
intensity level.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 15 / 26
16. Distance Measures
For pixels p, q, z with coordinates (x, y), (s, t), (v, w) respectively, D is a
distance measure if
D(p, q) ≥ 0
D(p, q) = D(q, p)
D(p, z) ≤ D(p, q) + D(q, z)
The different types of distance measures are
Euclidean distance (De) : De(p, q) = [(x − s)2 + (y − t)2]
1
2
City-block distance (D4) : D4(p, q) = |x − s| + |y − t|
Chessboard distance (D8) : D8(p, q) = max(|x − s| , |y − t|)
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 16 / 26
17. Distance Measures
For euclidean measure, the pixels having a distance less than or equal
to some value r from (x, y), are the points contained in a disk of
radius r, centered at (x, y).
The pixels having a D4 distance from (x, y) less than or equal to
some value r form a diamond shape centered at (x, y).
The pixels having a D8 distance from (x, y) less than or equal to
some value r form a square shape centered at (x, y).
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 17 / 26
18. Storing an image
If an image intensity value is stored with k number of bits, then the
number of discrete intensity levels L is denoted by L = 2k.
Suppose an image is stored with 8 bit. Then the number of discrete
intensity levels will be 28 = 256. That is the the intensity values are
ranging from 0 to 255. These discrete levels are equally spaced and
they are integers in the interval [0, L − 1].
Hence to store a k bit image with size MxN , the number of bits
required is M × N × k.
For a 1600 × 1200 color image of 8 bit, the required storage space is
given by 1600 × 1200 × 3 × 8 = 46080000 bits or 5760000 bytes or
5.76 Mb.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 18 / 26
19. Intensity Transformations
The spatial domain processes can be denoted by the expression
g(x, y) = T[f (x, y)]
where f (x, y) is the input image and g(x, y) is the output image
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 19 / 26
20. Image Negatives
The negative of an image with intensity levels in the range [0, L − 1]
is obtained by using the negative transformation, given by the
expression s = (L − 1) − r.
Figure: image negetive
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 20 / 26
21. Log Transformations
The general form of log transformation is given by
s = c log(1 + r)
The general form of power law (gamma)transformation is given by
s = crγ
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 21 / 26
22. Contrast stretching
Contrast stretching is a process that expands the range of intensity
levels in an image so that it spans the full intensity range of the
recording medium or display device.
The result of contrast stretching is obtained by setting
(r1, s1) = (rmin, 0)
and
(r2, s2) = (rmax, L − 1)
where rmin and rmaxdenote the minimum and maximum intensity
levels in the image respectively.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 22 / 26
24. Image Histogram
The histogram of a digital image with intensity levels in the range
[0,L-1] is a discrete function h(rk) = nk, where rk is the kth intensity
value and nkis the number of pixels in the image with intensity rk.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 24 / 26
25. References
Rafael C. Gonzalez, Richard E. Woods (2008)
Digital Image Processing
Pearson Education 2009,Third Edition.
Mithun kumar kar (BCET) Digital Image Processing July 14, 2020 25 / 26