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.


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
Code Generation Support, Usage Notes, and Limitations.


cloneCreate image complementer object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
release Allow property value and input characteristics changes
stepCompute complement of input image


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?