function mse = mserror(A, B) % The function takes two equal images and calculates the mean square % difference inbetween the two. % Usage: MSE = MSERROR(A, B, NSIZE); % where A: first image % B: second image % NSIZE: size of the images diff = A - B; % difference diff_sq = diff .^ 2; % difference squared mse_clmn = mean(diff_sq); % means square diff. of the columns; mse = mean(mse_clmn);