def is_low_contrast(image, fraction_threshold=0.05, lower_percentile=1, upper_percentile=99, method='linear'):
 image = np.asanyarray(image)
 if ((image.ndim == 3) and (image.shape[2] in [3, 4])):
  image = rgb2gray(image)
 dlimits = dtype_limits(image, clip_negative=False)
 limits = np.percentile(image, [lower_percentile, upper_percentile])
 ratio = ((limits[1] - limits[0]) / (dlimits[1] - dlimits[0]))
 return (ratio < fraction_threshold)

def is_low_contrast ( image , fraction_threshold = 0.05 , lower_percentile = 1 , upper_percentile = 99 , method = 'linear' ) : image = np . asanyarray ( image ) if ( ( image . ndim == 3 ) and ( image . shape [ 2 ] in [ 3 , 4 ] ) ) : image = rgb2gray ( image ) dlimits = dtype_limits ( image , clip_negative = False ) limits = np . percentile ( image , [ lower_percentile , upper_percentile ] ) ratio = ( ( limits [ 1 ] - limits [ 0 ] ) / ( dlimits [ 1 ] - dlimits [ 0 ] ) ) return ( ratio < fraction_threshold )
detemine if an image is low contrast .