machinevisiontoolbox.Image.__sub__

Image.__sub__(other)[source]

Overloaded - operator

Returns:

elementwise subtraction of images

Return type:

Image

Compute the difference of an Image with another image or a scalar. Supports:

  • image - image, elementwise

  • scalar - image

  • image - scalar

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image([[1, 2], [3, 4]])
>>> z = img - img
>>> z.image
array([[0, 0],
       [0, 0]], dtype=uint8)
>>> z = img - 1
>>> z.image
array([[0, 1],
       [2, 3]], dtype=uint8)
..warning:: Values will be wrapped not clipped to the range of the

pixel datatype.