This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Image Complement

Compute complement of pixel values in binary or intensity images





The Image Complement block computes the complement of a binary or intensity image. For binary images, the block replaces pixel values equal to 0 with 1 and pixel values equal to 1 with 0. For an intensity image, the block subtracts each pixel value from the maximum value that can be represented by the input data type and outputs the difference.

For example, suppose the input pixel values are given by x(i) and the output pixel values are given by y(i). If the data type of the input is double or single precision floating-point, the block outputs y(i) = 1.0-x(i). If the input is an 8-bit unsigned integer, the block outputs y(i) = 255-x(i).

PortInput/OutputSupported Data TypesComplex Values Supported


Vector or matrix of intensity values

  • Double-precision floating point

  • Single-precision floating point

  • Boolean

  • 8-, 16-, 32-bit signed integer

  • 8-, 16-, 32-bit unsigned integer



Complement of a binary or intensity

Same as Input port


The dimensions, data type, complexity, and frame status of the input and output signals are the same.

See Also


Computer Vision Toolbox™ software

Chroma Resampling

Computer Vision Toolbox software

Color Space Conversion

Computer Vision Toolbox software

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced before R2006a