def norm_brightness_err(img1, img2):
 if (img1.ndim == 3):
  (img1, img2) = (rgb2gray(img1), rgb2gray(img2))
 ambe = np.abs((img1.mean() - img2.mean()))
 nbe = (ambe / dtype_range[img1.dtype.type][1])
 return nbe

def norm_brightness_err ( img1 , img2 ) : if ( img1 . ndim == 3 ) : ( img1 , img2 ) = ( rgb2gray ( img1 ) , rgb2gray ( img2 ) ) ambe = np . abs ( ( img1 . mean ( ) - img2 . mean ( ) ) ) nbe = ( ambe / dtype_range [ img1 . dtype . type ] [ 1 ] ) return nbe
normalized absolute mean brightness error between two images parameters img1 : array-like img2 : array-like returns norm_brightness_error : float normalized absolute mean brightness error .