Image Processing Toolbox | ![]() ![]() |
Image Arithmetic
Image arithmetic is the implementation of standard arithmetic operations, such as addition, subtraction, multiplication, and division, on images. Image arithmetic has many uses in image processing both as a preliminary step in more complex operations and by itself. For example, image subtraction can be used to detect differences between two or more images of the same scene or object.
You can do image arithmetic using the MATLAB arithmetic operators; however, you must convert the images to class double
to use these operators. To make working with images more convenient, the Image Processing Toolbox includes a set of functions that implement arithmetic operations for all numeric, nonsparse data types. The advantages to using these functions include:
double
data type is necessary. The functions accept any numeric data type, including uint8
, uint16
, and double
, and return the result image in the same format. Note that the functions perform the operations in double precision, on an element-by-element basis, but do not convert images to double precision values in the MATLAB workspace.
See Summary of Image Arithmetic Functions for a complete list. For more information about using these functions to perform arithmetic operations, see these sections:
![]() | Converting Graphics File Formats | Summary of Image Arithmetic Functions | ![]() |