You are here : matlabImage Processingimabsdiff

imabsdiff() - Image Processing

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.examplegpuarrayZ = imabsdiff(gpuarrayX,gpuarrayY) 
performs the computation on a GPU, if at least one of the inputs is
a gpuArray. The output image is a gpuArray. This syntax requires the Parallel Computing Toolbox™.Code Generation support:
Yes.MATLAB Function Block support:


Z = imabsdiff(X,Y) examplegpuarrayZ = imabsdiff(gpuarrayX,gpuarrayY) example


Display Absolute Difference between Filtered image and OriginalOpen This Example
Read image into workspace.I = imread('cameraman.tif');
Filter the image.J = uint8(filter2(fspecial('gaussian'), I));
Calculate the absolute difference of the two images.K = imabsdiff(I,J);
Display the absolute difference image.figure

Display Absolute Difference Between Filtered Image and Original on GPURead image and convert it to a GPUarray.I = gpuArray(imread('cameraman.tif'));
Filter the image, performing the operation on a GPU.J = imfilter(I,fspecial('gaussian'));
Calculate the absolute difference between the filtered
image and original image.K = imabsdiff(I,J);
Display the absolute difference image.figure

Output / Return Value


Alternatives / See Also