MATLAB: Differece image of 2 images

difference image

How to calculate difference image of 2 images read from different folders?

Best Answer

MATLAB provides imabsdiff function to find the absolute difference of two images. The following code might help you.
% read image from folder 1
image1=imread('yourImage1.png');
% read image from folder 2
image2=imread('yourImage2.png');
% calculate the absolute difference
absDiffImage=imabsdiff(image1,image2);
% plot the absolute difference image
figure;
imshow(absDiffImage,[]);
colormap(jet);
colorbar;
Related Question