machinevisiontoolbox.Image.__invert__

Image.__invert__()[source]

Overloaded ~ operator

Returns:

elementwise inversion of logical values

Return type:

boo, Image

Returns logical not operation where image values are interpretted as:

  • floating image: True is 1.0, False is 0.0

  • integer image: True is maximum value, False is 0 True is 1 and False is 0.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image([[True, False], [False, True]])
>>> z = ~img
>>> z.image
array([[False,  True],
       [ True, False]])