This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

vision.ImageComplementer System object

Package: vision

Complement of pixel values in binary or intensity image


    Note:   The vision.ImageComplementer System object will be removed in a future release. Use the imcomplement function with equivalent functionality instead.

The ImageComplementer object computes the complement of pixel values in binary or intensity image. For binary images, the object replaces pixel values equal to 0 with 1, and pixel values equal to 1 with 0. For an intensity image, the object subtracts each pixel value from the maximum value the data input type can represent and then outputs the difference.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = vision.ImageComplementer returns an image complement System object, H. The object computes the complement of a binary, intensity, or RGB image.

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation (MATLAB Coder)
Code Generation Support, Usage Notes, and Limitations.


stepCompute complement of input image
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


Compute the complement of an input image.

 himgcomp = vision.ImageComplementer;
 hautoth = vision.Autothresholder; 

% Read in image
	I = imread('coins.png');

% Convert the image to binary
	bw = step(hautoth, I); 

% Take the image complement
	Ic = step(himgcomp, bw);

% Display the results
	subplot(2,1,1), imshow(bw), title('Original Binary image')
 	subplot(2,1,2), imshow(Ic), title('Complemented image')  


This object implements the algorithm, inputs, and outputs described on the Image Complement block reference page. The object properties correspond to the block parameters.

Introduced in R2012a

Was this topic helpful?