vision.ContrastAdjuster System object

Package: vision

Adjust image contrast by linear scaling

Description

The ContrastAdjuster object adjusts image contrast by linearly scaling pixel values between upper and lower limits. Pixel values that are above or below this range are saturated to the upper or lower limit values.

Construction

H = vision.ContrastAdjuster returns a contrast adjustment object, H. This object adjusts the contrast of an image by linearly scaling the pixel values between the maximum and minimum values of the input data.

H = vision.ContrastAdjuster(Name,Value) returns a contrast adjustment object, H, with each property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

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

Properties

InputRange

How to specify lower and upper input limits

Specify how to determine the lower and upper input limits as one of Full input data range [min max] | Custom | Range determined by saturating outlier pixels. The default is Full input data range [min max].

CustomInputRange

Lower and upper input limits

Specify the lower and upper input limits as a two-element vector of real numbers. The first element corresponds to the lower input limit, and the second element corresponds to the upper input limit. This property applies only when you set the InputRange property to Custom. This property is tunable.

PixelSaturationPercentage

Percentage of pixels to consider outliers

Specify the percentage of pixels to consider outliers, as a two-element vector. This property only applies when you set the InputRange property to Range determined by saturating outlier pixels.

The contrast adjustment object calculates the lower input limit. This calculation ensures that the maximum percentage of pixels with values smaller than the lower limit can only equal the value of the first element.

Similarly, the object calculates the upper input limit. This calculation ensures that the maximum percentage of pixels with values greater than the upper limit is can only equal the value of the second element.

The default is [1 1].

HistogramNumBins

Number of histogram bins

Specify the number of histogram bins used to calculate the scaled input values.

The default is 256.

OutputRangeSource

How to specify lower and upper output limits

Specify how to determine the lower and upper output limits as one of Auto | Property. The default is Auto. If you set the value of this property to Auto, the object uses the minimum value of the input data type as the lower output limit. The maximum value of the input data type indicates the upper output limit.

OutputRange

Lower and upper output limits

Specify the lower and upper output limits as a two-element vector of real numbers. The first element corresponds to the lower output limit, and the second element corresponds to the upper output limit. This property only applies when you set the OutputRangeSource property to Property. This property is tunable.

 Fixed-Point Properties

Methods

cloneCreate contrast adjuster 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
stepAdjust contrast in input image

Examples

Use contrast adjuster to enhance image quality:

 hcontadj = vision.ContrastAdjuster;
 x = imread('pout.tif');
 y = step(hcontadj, x);

 imshow(x); title('Original Image');
 figure, imshow(y); 
 title('Enhanced image after contrast adjustment'); 

Algorithms

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

Was this topic helpful?