MATLAB Algorithm to compare two images

http://www.xkcd.com/246/

Labyrinth Puzzle by XKCD

Imagine you have two images of the same size and shape; however, there are differences between the images (like a game of spot 10 different things). MATLAB is the baws:

im = double(imread('input.jpg'))/255;
imsize = size(im);
width = imsize(2)/2;
imdiff = abs(im(:,1:width,:) - im(:,(width+1):end,:));
imwrite(imdiff, 'result.jpg');

The output will generate areas of difference.

Math, you’re the bomb!