Image Processing Toolbox User's Guide Previous page   Next Page
imabsdiff

Compute absolute difference of two images

Syntax

Description

Z = imabsdiff(X,Y) subtracts each element in array Y from the corresponding element in array X and returns the absolute difference in the corresponding element of the output array Z. X and Y are real, nonsparse numeric arrays with the same class and size. Z has the same class and size as X and Y. If X and Y are integer arrays, elements in the output that exceed the range of the integer type are truncated.

If X and Y are double arrays, you can use the expression abs(X-Y) instead of this function.

Examples

This example calculates the absolute difference between two uint8 arrays. Note that the absolute value prevents negative values from being rounded to zero in the result, as they are with imsubtract.

Display the absolute difference between a filtered image and the original.

See Also

imadd, imcomplement, imdivide, imlincomb, immultiply, imsubtract, ippl


Previous page  im2uint8 imadd Next page

© 1994-2005 The MathWorks, Inc.