% script for generationg the difference image
function diffImage(orig_img_name,gm_img_name,diff_img_name,scale)

% define the Yy offset and the scale to be used
if nargin <= 3
    scale = 3.0;
end
yy_offset = 50;

% convert the two images into YyCxCz
origName = ['input/',orig_img_name];
gmName = ['output/',gm_img_name];
ycxcz_orig = rgb2ycxcz4Visual(origName);
ycxcz_gm = rgb2ycxcz4Visual(gmName);

% compute the difference image
ycxcz_diff = scale*(ycxcz_gm-ycxcz_orig);
ycxcz_diff(:,:,1) = ycxcz_diff(:,:,1)+yy_offset;

% convert the difference image back to sRGB and save it
diff_img = ycxcz2rgb4Visual(ycxcz_diff);
imwrite(uint8(diff_img),['output/',diff_img_name]);