Image Processing Reference
In-Depth Information
Fig. 4.24 Different logic
Other arithmetic operations can also be used to combine two images, but most
often addition or subtraction are the ones applied. No matter the operation image
arithmetic works equally well for gray-scale and color images.
When adding two images some of the pixel values in the output image might
have values above 255. For example if f 1 ( 10 , 10 )
150 and f 2 ( 10 , 10 )
200, then
g( 10 , 10 )
350. In principle this does not matter, but if an 8-bit image is used for
the output image, then we have the problem known as overflow . That is, the value
cannot be represented. A similar situation can occur for image subtraction where a
negative number can appear in the output image. This is known as underflow .
One might argue that we could simply use a 16 or 32-bit image to avoid these
problems. However, using more bit per pixel will take up more space in the computer
memory and require more processing power from the CPU. When dealing with
many images, e.g., video data, this can be a problem.
The solution is therefore to use a temporary image (16-bit or 32-bit) to store
the result and then map the temporary image to a standard 8-bit image for further
processing. This principle is illustrated in Fig. 4.25 .
This algorithm is the same as used for histogram stretching except that the mini-
mum value can be negative:
1. Find the minimum number in the temporary image, f 1
2. Find the maximum number in the temporary image, f 2
3. Shift all pixels so that the minimum value is 0: g i (x, y) = g i (x, y) f 1
4. Scale all pixels so that the maximum value is 255: g(x,y)
f 2 f 1
g i (x, y)
where g i (x, y) is the temporary image.
Search WWH ::

Custom Search