machinevisiontoolbox.Image.clip

Image.clip(min, max)

Clip pixel values

Parameters:
  • min (int or float) – minimum value

  • max (int or float) – maximum value

Returns:

transformed image

Return type:

Image

Pixels in the returned image will have values in the range [min, max] inclusive.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image([[1, 2], [3, 4]])
>>> img.clip(2, 3).A
array([[2, 2],
       [3, 3]], dtype=uint8)
Seealso:

numpy.clip