machinevisiontoolbox.Image.invert
- Image.invert()
Invert image
- Returns:
_description_
- Return type:
_type_
For an integer image
\[\begin{split}Y_{u,v} = \left\{ \begin{array}{l} p_{\mbox{max}} \mbox{, if } X_{u,v} = 0 \\ p_{\mbox{min}} \mbox{, otherwise} \end{array}\right.\end{split}\]where \(p_{\mbox{min}}\) and \(p_{\mbox{max}}\) are respectively the minimum and maximum value of the datatype.
For a float image
\[\begin{split}Y_{u,v} = \left\{ \begin{array}{l} 1.0 \mbox{, if } X_{u,v} = 0 \\ 0.0 \mbox{, otherwise} \end{array}\right.\end{split}\]Example:
>>> from machinevisiontoolbox import Image >>> img = Image([[0, 1], [2, 3]]) >>> img.invert().image array([[255, 0], [ 0, 0]], dtype=uint8)