Image Processing Reference

In-Depth Information

Fig. 4.25
An example of overflow and how to handle it. The addition of the images produces

values above the range of the 8-bit image, which is handled by storing the result in a temporary

image. In this temporary image the highest value is identified, and used to scale the intensity values

down into the 8-bit range. The same approach is used for underflow. This approach also works for

images with both over- and underflow

Image arithmetic has a number of interesting usages and here two are presented.

In Chap. 8 we present another one, which is related to video processing.

The first one is simply to invert an image. That is, a black pixel in the input

becomes a white pixel in the output etc. The equation for image inversion is defined

in Eq.
4.17
and an example is illustrated in Fig.
4.26
.

g(x,y)
=

255

−
f(x,y)

(4.17)

Another use of image arithmetic is
alpha blending
. Alpha blending is used when

mixing two images, for example gradually changing from one image to another

image. The idea is to extend Eq.
4.16
so that the two images have different impor-

tance. For example 20% of
f
1
(x, y)
and 80% of
f
2
(x, y)
. Note that the sum of the

two percentages should be 100%. Concretely, the equation is rewritten as

g(x,y)

=

α

·

f
1
(x, y)

+

(
1

−

α)

·

f
2
(x, y)

(4.18)