function error = img_difference(img1,img2,f_size)

c = floor(f_size/2)+1;
img1 = img1(c:end-c,c:end-c);
img2 = img2(c:end-c,c:end-c);

img_diff = abs(img1-img2);

figure
imshow(img_diff,[])
title('difference','FontSize',14,'fontweight','bold')

error = sum(img_diff(:));

[x,y] = size(img1);
error = error /((x-2*c)*(y-2*c));