def adjust_gamma(image, gamma=1, gain=1):
 _assert_non_negative(image)
 dtype = image.dtype.type
 if (gamma < 0):
  raise ValueError('Gamma should be a non-negative real number.')
 scale = float((dtype_limits(image, True)[1] - dtype_limits(image, True)[0]))
 out = ((((image / scale) ** gamma) * scale) * gain)
 return dtype(out)

def adjust_gamma ( image , gamma = 1 , gain = 1 ) : _assert_non_negative ( image ) dtype = image . dtype . type if ( gamma < 0 ) : raise ValueError ( 'Gamma should be a non-negative real number.' ) scale = float ( ( dtype_limits ( image , True ) [ 1 ] - dtype_limits ( image , True ) [ 0 ] ) ) out = ( ( ( ( image / scale ) ** gamma ) * scale ) * gain ) return dtype ( out )
performs gamma correction on the input image .