Chapter 06

Arithmetic and Logic Operations

What will we Learn?

  • Which arithmetic and logic operations can be applied to digital images?
  • How are they performed in MATLAB?
  • What are they used for?

6.1 Arithmetic Operations: Fundamentals and Applications

Arithmetic operations involving images are typically performed on a pixel-by-pixel basis; that is, the operation is independently applied to each pixel in the image. Given a 2D array (X) and another 2D array of the same size or a scalar (Y), the resulting array, Z, is obtained by calculating

(6.1)equation

where opn is a binary arithmetic (+, −, ×, /) operator.

This section describes each arithmetic operation in more detail, focusing on how they can be performed and what are their typical applications.

6.1.1 Addition

Addition is used to blend the pixel contents from two images or add a constant value to pixel values of an image. Adding the contents of two monochrome images causes their contents to blend (Figure 6.1). Adding a constant value (scalar) to an image causes an increase (or decrease if the value is less than zero) in its overall brightness, a process sometimes referred to as additive image offset (Figure 6.2). Adding random amounts to each pixel value is a common way to simulate additive noise (Figure 6.3). The resulting (noisy) image is typically used as a test image for restoration algorithms such as those described in Chapter 12. ...

Get Practical Image and Video Processing Using MATLAB® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.