def clip_image ( image , clip_min , clip_max ) : return np . minimum ( np . maximum ( clip_min , image ) , clip_max )
how to do thresholding of an image in python
Clip an image or an image batch with upper and lower threshold .
def clip_image(image, clip_min, clip_max):
  """ Clip an image, or an image batch, with upper and lower threshold. """
  return np.minimum(np.maximum(clip_min, image), clip_max)