vision.ChromaResampler System object

Package: vision

Downsample or upsample chrominance components of images

Description

The ChromaResampler object downsamples or upsample chrominance components of images.

Construction

H = vision.ChromaResampler returns a chroma resampling System object, H, that downsamples or upsamples chroma components of a YCbCr signal to reduce the bandwidth and storage requirements.

H = vision.ChromaResampler(Name,Value) returns a chroma resampling System object, H, with each specified 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

Resampling

Resampling format

To downsample the chrominance components of images, set this property to one of the following:

[4:4:4 to 4:2:2]
[4:4:4 to 4:2:0 (MPEG1)]
[4:4:4 to 4:2:0 (MPEG2)]
[4:4:4 to 4:1:1]
[4:2:2 to 4:2:0 (MPEG1)]
[4:2:2 to 4:2:0 (MPEG2)]

To upsample the chrominance components of images, set this property to one of the following:

[4:2:2 to 4:4:4]
[4:2:0 (MPEG1) to 4:4:4]
[4:2:0 (MPEG2) to 4:4:4]
[4:1:1 to 4:4:4]
[4:2:0 (MPEG1) to 4:2:2]
[4:2:0 (MPEG2) to 4:2:2]

The default is [4:4:4 to 4:2:2]

InterpolationFilter

Method used to approximate missing values

Specify the interpolation method used to approximate the missing chrominance values as one of Pixel replication | Linear. The default is Linear. When you set this property to Linear, the object uses linear interpolation to calculate the missing values. When you set this property to Pixel replication, the object replicates the chrominance values of the neighboring pixels to create the upsampled image. This property applies when you upsample the chrominance values.

AntialiasingFilterSource

Lowpass filter used to prevent aliasing

Specify the lowpass filter used to prevent aliasing as one of Auto | Property | None. The default is Auto. When you set this property to Auto, the object uses a built-in lowpass filter. When you set this property to Property, the coefficients of the filters are specified by the HorizontalFilterCoefficients and VerticalFilterCoefficients properties. When you set this property to None, the object does not filter the input signal. This property applies when you downsample the chrominance values.

HorizontalFilterCoefficients

Horizontal filter coefficients

Specify the filter coefficients to apply to the input signal. This property applies when you set the Resampling property to one of [4:4:4 to 4:2:2] | [4:4:4 to 4:2:0 (MPEG1)] | [4:4:4 to 4:2:0 (MPEG2)] | [4:4:4 to 4:1:1] and the AntialiasingFilterSource property to Property. The default is [0.2 0.6 0.2].

VerticalFilterCoefficients

Vertical filter coefficients

Specify the filter coefficients to apply to the input signal. This property applies when you set the Resampling property to one of [4:4:4 to 4:2:0 (MPEG1)] | [4:4:4 to 4:2:0 (MPEG2)] | [4:2:2 to 4:2:0 (MPEG1)] | [4:2:2 to 4:2:0 (MPEG2)] and the AntialiasingFilterSource property to Property. The default is [0.5 0.5].

TransposedInput

Input is row-major format

Set this property to true when the input contains data elements from the first row first, then data elements from the second row second, and so on through the last row. Otherwise, the object assumes that the input data is stored in column-major format. The default is false.

Methods

cloneCreate chroma resampling 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
stepResample input chrominance components

Examples

Resample the chrominance components of an image.

 H = vision.ChromaResampler;
 hcsc = vision.ColorSpaceConverter;
 x = imread('peppers.png');
 x1 = step(hcsc, x);
 [Cb, Cr] = step(H, x1(:,:,2), x1(:,:,3));

Algorithms

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

Was this topic helpful?