Image Processing Reference

In-Depth Information

The number of neighborhood pixels to include in the calculation of the average

image depends on the nature of the uneven illumination, but in general it should be a

very high number. The method assumes the foreground objects of interest are small

compared to the background. The more this assumption is violated, the worse the

method performs.

4.5

Logic Operations on Binary Images

After thresholding we have a binary image consisting of only white pixels (255)

and black pixels (0). We can combine two binary images using logic operations.

The basic logic operations are NOT, AND, OR, and XOR (exclusive OR). The NOT

operation do not combine two images but only works on one at a time. NOT simply

means to invert the binary image. That is, if a pixel has the value 0 in the input it

will have the value 255 in the output, and if the input is 255 the output will be 0.

The three other basic logic operations combine two images into one output. Their

operations are described using a so-called
truth table
. Below the three truth tables

are listed.

A truth table is interpreted in the following way. The left-most column contains

the possible values a pixel in image 1 can have. The topmost row contains the pos-

sible values a pixel in image 2 can have. The four remaining values are the output

values. From the truth tables we can for example see that 255 AND 0

=

0, and 0 OR

255

255. In Fig.
4.24
a few other examples are shown. Note that from a program-

ming point of view white can be represented by 1 and only one byte is then required

to represent each pixel. This can save memory and speed up the implementation.

=

4.6

Image Arithmetic

Instead of combining an image with a scalar as in Eq.
4.1
, an image can also be

combined with another image. Say we have two images of equal size,
f
1
(x, y)
and

f
2
(x, y)
. These are combined pixel-wise in the following way:

g(x,y)

=

f
1
(x, y)

+

f
2
(x, y)

(4.16)