vision.ImageComplementer System object

Package: vision

Complement of pixel values in binary or intensity image

Description

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.

Construction

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.

Methods

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

Examples

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
 	figure;
	subplot(2,1,1), imshow(bw), title('Original Binary image')
 	subplot(2,1,2), imshow(Ic), title('Complemented image')  

Algorithms

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

Was this topic helpful?