@adapt_rgb(hsv_value)
def equalize_adapthist(image, kernel_size=None, clip_limit=0.01, nbins=256, **kwargs):
 image = img_as_uint(image)
 image = rescale_intensity(image, out_range=(0, (NR_OF_GREY - 1)))
 if kwargs:
  if (('ntiles_x' in kwargs) or ('ntiles_y' in kwargs)):
   msg = '`ntiles_*` have been deprecated in favor of `kernel_size`'
   raise ValueError(msg)
 if (kernel_size is None):
  kernel_size = ((image.shape[0] // 8), (image.shape[1] // 8))
 elif isinstance(kernel_size, numbers.Number):
  kernel_size = ((kernel_size,) * image.ndim)
 elif (len(kernel_size) != image.ndim):
  ValueError('Incorrect value of `kernel_size`: {}'.format(kernel_size))
 kernel_size = [int(k) for k in kernel_size]
 image = _clahe(image, kernel_size, (clip_limit * nbins), nbins)
 image = img_as_float(image)
 return rescale_intensity(image)

@ adapt_rgb ( hsv_value ) def equalize_adapthist ( image , kernel_size = None , clip_limit = 0.01 , nbins = 256 , ** kwargs ) : image = img_as_uint ( image ) image = rescale_intensity ( image , out_range = ( 0 , ( NR_OF_GREY - 1 ) ) ) if kwargs : if ( ( 'ntiles_x' in kwargs ) or ( 'ntiles_y' in kwargs ) ) : msg = '`ntiles_*` have been deprecated in favor of `kernel_size`' raise ValueError ( msg ) if ( kernel_size is None ) : kernel_size = ( ( image . shape [ 0 ] // 8 ) , ( image . shape [ 1 ] // 8 ) ) elif isinstance ( kernel_size , numbers . Number ) : kernel_size = ( ( kernel_size , ) * image . ndim ) elif ( len ( kernel_size ) != image . ndim ) : ValueError ( 'Incorrect value of `kernel_size`: {}' . format ( kernel_size ) ) kernel_size = [ int ( k ) for k in kernel_size ] image = _clahe ( image , kernel_size , ( clip_limit * nbins ) , nbins ) image = img_as_float ( image ) return rescale_intensity ( image )
contrast limited adaptive histogram equalization .