Arithmetic and Logical Operations
Arithmetic and Logical Operations
operations
10/06/21
Arithmetic operations
Arithmetic operations between images are
array operations that are carried out between
corresponding pixel pairs.
Addition: s( x, y ) f ( x, y ) g ( x, y )
Subtraction:
d ( x, y ) f ( x, y ) g ( x, y )
Multiplication:
p ( x, y ) f ( x, y ) * g ( x, y )
Division:
v ( x, y ) f ( x, y ) / g ( x, y )
Arithmetic operations
It is understood the that operations are
performed between corresponding pixel pairs
in f and g for x=0, 1, 2,…, M-1 and y=0, 1, 2,
…N-1 where M and N are the row and column
sizes of the images.
Clearly, s, d, p, v are image of size M * N.
Arithmetic operations
s ( x, y ) 0 when f ( x, y ) g ( x, y ) 0
s ( x, y ) f ( x, y ) g ( x, y ) 0 for
f ( x, y ) g ( x, y ) 255
s ( x, y ) 255 when f ( x, y ) g ( x, y ) 255
Addition
Let image
s ( x, y ) f ( x, of
is the sum y) g ( x, and
y)
10 0 20 1 50 10 0 2
0 0
0 20 20 0 25 40 10 5
0 5 0
10 10 0 50 0 10 20 50
0 g ( x0, y )
f ( x, y )
60 10 20 3
0 0
25 60 25 5
5 5
10 20 20 10
0 s( x, y0) 0
Application
Suppose image
s ( x, y ) is formed by addition
of a noiseless fimage
( x, y ) and
( x, y )noise
The assumption is that at every pair of ( x, y )
coordinates the noise is uncorrelated
and has zero average.
The objective of the following procedure is to
reduce the noise content by adding noisy
images.
Example
a. Mask image
b. A live
image
c. Difference
between a &
b
d. Enhanced
difference
image.
Multiplication
f ( x, y ) g ( x, y )
0 255 0 255 0 0 0 0
255 0 255 0 0 255 255 0
0 255 0 255 0 255 255 0
255 0 255 0 0 0 0 0
f ( x, y ) g ( x, y )
Multiplication
0 0 0 0
0 0 255 0
0 255 0 0
0 0 0 0
p ( x, y ) p ( x, y )
application
An important application of image
multiplication( and division) is shading.
Another common use of image is in masking,
also called region of interest(ROI).
Logical operation
When dealing with binary image, one can
think of foreground and background sets of
pixels.
If the regions being composed of foreground
pixels, the set operations become operations
between the coordinates of objects in a
binary image.
AND, OR, NOT are the basic three logical
operations, where logical arises from logic
theory in which 1 and 0 denote true and false.
Logical operation(AND)
A B
0 0 0 0 0 0 1 1
0 1 1 0 0 0 1 1
A B
0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0
0 0 1 0
A (AND) B 0 0 0 0
0 0 0 0
Logical operation(OR)
A B
0 0 0 0 0 0 1 1
0 1 1 0 0 0 1 1
A B
0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 1 1
0 1 1 1
A (OR) B 0 1 1 0
0 0 0 0
Logical operation(NOT)
A A’
0 0 0 0 1 1 1 1
0 1 1 0 1 0 0 1
0 1 1 0 1 0 0 1
0 0 0 0 1 1 1 1
A A’