We distinguish in this section between binary arithmetic and ordinary arithmetic. In the binary case there are two brightness values "0" and "1". In the ordinary case we begin with 2B brightness values or levels but the processing of the image can easily generate many more levels. For this reason many software systems provide 16 or 32 bit representations for pixel brightnesses in order to avoid problems with arithmetic overflow.
The implication is that each operation is applied on a pixel-by-pixel basis. For example, . The definition of each operation is:
These operations are illustrated in Figure 22 where the binary value "1" is shown in black and the value "0" in white.
Figure 22: Examples of the various binary point operations.
The SUB(*) operation can be particularly useful when the image a represents a region-of-interest that we want to analyze systematically and the image b represents objects that, having been analyzed, can now be discarded, that is subtracted, from the region.
Operation
|
Definition
|
preferred
data type
|
|
ADD
|
c
= a + b
|
integer
|
|
SUB
|
c
= a - b
|
integer
|
|
MUL
|
c
= a * b
|
integer
or floating point
|
|
DIV
|
c
= a / b
|
floating
point
|
|
LOG
|
c
= log(a)
|
floating
point
|
|
EXP
|
c
= exp(a)
|
floating
point
|
|
SQRT
|
c
= sqrt(a)
|
floating
point
|
|
TRIG.
|
c
= sin/cos/tan(a)
|
floating
point
|
|
INVERT
|
c
= (2B - 1) - a
|
integer
|