Чтобы создать разницу с пикселем слева, все, что вам нужно сделать, это вычесть пиксели в столбцах 1,2,3 ... из столбцов 2,3,4 ...
%# create a random image with four values
randomImage = randi(4,[100,90]); %# use different numbers of rows and cols so we know which is which
%# catenate the first column of the image with the difference from the pixel to the left
%# for all pairs of columns in the image
differenceImage = [randomImage(:,1),randomImage(:,1:end-1)-randomImage(:,2:end)];
Да, вы ожидаете довольно много однородных исправлений (которые будут серыми, поскольку, если вы не нанесете абсолютное значение различий, будут отрицательные).