FUNCTION REFERENCE

imcomplement

Complement an image.

Complement an image.

Syntax

J = imcomplement(I)

Double and single images give 1 - I; logical images give ~I; unsigned integers give intmax - I; signed integers give intmax + intmin - I (= -1 - I), which maps the smallest value to the largest. The class is kept. Works on 2-D and M-by-N-by-C arrays.

Example

imcomplement(uint8([0 55 255]))   % uint8 [255 200 0]

Example

imcomplement([0 0.25 1])   % [1 0.75 0]

Differences from MATLAB: the reference page states the rule for unsigned classes only (subtract from the class maximum); for signed classes MatRust reflects about the middle of the range as described above.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.