function per = imerror(im1,im2)
%
% imerror: returns the error from im1 to im2 (assumes they are the same size)
% On input:
%     im1: image 1
%     im2: image 2
% On output:
%     per: average per pixel over whole image set
% Call:
%     per = imerror(im1,im2)
%

  [m,n] = size(im1);

  diff = abs(im1 - im2);

  sumdif = sum(sum(diff.*diff)); 
 
  dist = sqrt(sumdif);	
	
  per = dist / (m*n);


  % per = max(max(diff));