imcomplement
Complement image
Syntax
Description
calculates the complement of the image J
= imcomplement(I
)I
and returns the result
in J
.
In the complement of a binary image, zeros become ones and ones become zeros. Black and white are reversed.
In the complement of a grayscale or color image, each pixel value is subtracted from the maximum pixel value supported by the class (or 1.0 for double-precision images). The difference is used as the pixel value in the output image. In the output image, dark areas become lighter and light areas become darker. For color images, reds become cyan, greens become magenta, blues become yellow, and vice versa.
Examples
Input Arguments
Output Arguments
Tips
If
I
is a grayscale or RGB image of classdouble
, then you can use the expression1-I
instead of this function.If
I
is a binary image, then you can use the expression~I
instead of this function.
Extended Capabilities
Version History
Introduced before R2006a
See Also
imabsdiff
| imadd
| imdivide
| imlincomb
| immultiply
| imsubtract