Image.clip#

Image.clip(min: int | float, max: int | float) → Self[source]#

Clip pixel values

Parameters:
Returns:

transformed image

Return type:

Image

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

Examples

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

See also

numpy.clip