Image Processing Toolbox    
imadd

Add two images, or add a constant to an image

Syntax

Description

Z = imadd(X,Y) adds each element in array X with the corresponding element in array Y and returns the sum in the corresponding element of the output array Z. X and Y are real, nonsparse numeric arrays with the same size and class, or Y is a scalar double. The array returned, Z, has the same size and class, or Y is a scalar double. Z has the same size and class as X.

If X and Y are integer arrays, elements in the output that exceed the range of the integer type are truncated, and fractional values are rounded.

If X and Y are double arrays, you can use the expression X+Y instead of this function.

Examples

Add two uint8 arrays. Note the truncation that occurs when the values exceed 255.

Add two images together and specify an output class.

Add a constant to an image.

See also

imabsdiff, imcomplement, imdivide, imlincomb, immultiply, imsubtract


  imabsdiff imadjust