imcomplement
Complement image values.
📝Syntax
J = imcomplement(I)
📥Input Arguments
Parameter Description
I Input image.
📤Output Arguments
Parameter Description
J Complemented image with class matching I.
📄Description

Complement image values. Logical values are inverted. Unsigned integer images are complemented around their full class range. Signed integer images preserve their class and are complemented around the signed class range.

💡Examples
Complement an image
I=repmat(linspace(0,1,96),64,1);
J=imcomplement(I);
figure; subplot(1,2,1); imagesc(I); g=linspace(0,1,64)'; colormap([g g g]); title('Input');
subplot(1,2,2); imagesc(J); g=linspace(0,1,64)'; colormap([g g g]); title('Complement');
Example illustration
Complement signed integer values
J = imcomplement(int16([-32768 0 32767]))
🔗See Also
imadjustimbinarize
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub