def compare_nrmse(im_true, im_test, norm_type='Euclidean'):
 _assert_compatible(im_true, im_test)
 (im_true, im_test) = _as_floats(im_true, im_test)
 norm_type = norm_type.lower()
 if (norm_type == 'euclidean'):
  denom = np.sqrt(np.mean((im_true * im_true), dtype=np.float64))
 elif (norm_type == 'min-max'):
  denom = (im_true.max() - im_true.min())
 elif (norm_type == 'mean'):
  denom = im_true.mean()
 else:
  raise ValueError('Unsupported norm_type')
 return (np.sqrt(compare_mse(im_true, im_test)) / denom)

def compare_nrmse ( im_true , im_test , norm_type = 'Euclidean' ) : _assert_compatible ( im_true , im_test ) ( im_true , im_test ) = _as_floats ( im_true , im_test ) norm_type = norm_type . lower ( ) if ( norm_type == 'euclidean' ) : denom = np . sqrt ( np . mean ( ( im_true * im_true ) , dtype = np . float64 ) ) elif ( norm_type == 'min-max' ) : denom = ( im_true . max ( ) - im_true . min ( ) ) elif ( norm_type == 'mean' ) : denom = im_true . mean ( ) else : raise ValueError ( 'Unsupported norm_type' ) return ( np . sqrt ( compare_mse ( im_true , im_test ) ) / denom )
compute the normalized root mean-squared error between two images .