Arithmetic Operations in Digital Image Processing
Prepared by:
Team of Lecturers
Department of Electrical Engineering
Overview
There are such cases where we need to combine two different images altogether.
This can be performed by utilizing arithmetic operations.
These operations include image addition, subtraction, multiplication, division, and
blending.
1
One thing should be taken into
consideration
During the arithmetic operation, ensure that the result does not go beyond the allowed range. If
the result goes beyond, the pixel value is set to the maximum allowed range.
If a particular level is set, the value of each element cannot exceed that level.
Data Type Data Range
Uint8 0-255
Uint16 0-65,535
Uint32 0-4,294,967,295
Data type and allowed ranges
2
Image Addition
Two images can be added in a direct manner, as given by
𝑔 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 + 𝑓2 (𝑥, 𝑦)
Similarly, it is possible to add a constant value to a single image, as follows:
𝑔 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 + 𝑘
The higher the pixel value from
zero, the brighter the image will be
3
Image Addition
For instance,
10 12 5 7 15 19
+ =
9 14 9 3 18 17
+ 50 =
4
Image Addition
Another example,
+ =
5
Image Subtraction
Two images can be subtracted in a direct manner, as given by
𝑔 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 − 𝑓2 (𝑥, 𝑦)
Similarly, it is possible to subtract a constant value to a single image, as follows:
𝑔 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 − 𝑘
The higher the pixel value from
zero, the brighter the image will be
6
Image Subtraction
For instance,
10 12 5 7 5 5
- =
9 14 9 3 0 11
- 50 =
7
Image Subtraction
Another example,
- =
8
Image Division
Two images can be divided in a direct manner, as given by
𝑓1 𝑥, 𝑦
𝑔 𝑥, 𝑦 =
𝑓2 (𝑥, 𝑦)
Similarly, it is possible to divide a constant value to a single image, as follows:
𝑓1 𝑥, 𝑦
𝑔 𝑥, 𝑦 =
𝑘
The higher the pixel value from
zero, the brighter the image will be
9
Image Division
÷ =
10
Image Multiplication
Two images can be multiplied in a direct manner, as given by
𝑔 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 𝑥 𝑓2 (𝑥, 𝑦)
Similarly, it is possible to multiply a constant value to a single image, as follows:
𝑔 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 𝑥 𝑘
The higher the pixel value from
zero, the brighter the image will be
11
Image Multiplication
x =
12
Example
Consider the following 2 x 2, 8 level images A and B. Find out A + B, A – B, A x B, and A/B.
10 12 5 7
A= B=
9 14 9 3
13
References
Sridhar, S. (2016). Digital Image Processing (2nd ed.). Oxford University Press.
Thank You
15