machinevisiontoolbox.Image.__xor__

Image.__xor__(other)[source]

Overloaded ^ operator

Returns:

elementwise binary-xor of images

Return type:

Image

Compute the binary-xor of an Image with another image or a scalar. Supports:

  • image ^ image

  • scalar ^ image

  • image ^ scalar

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image([[1, 2], [3, 4]])
>>> z = img ^ Image([[2, 2], [2, 2]])
>>> z.image
array([[3, 0],
       [1, 6]], dtype=uint8)
>>> z = img ^ 1
>>> z.image
array([[0, 3],
       [2, 5]], dtype=uint8)