Main Content

vision.ChromaResampler

Downsample or upsample chrominance components of images

Description

To downsample or upsample chrominance components of images:

  1. Create thevision.ChromaResamplerobject and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, seeWhat Are System Objects?

Creation

Description

example

resampler= vision.ChromaResampler返回一个chroma resampling object,Cresampler, that downsamples or upsamples chroma components of a YCbCr signal to reduce the bandwidth and storage requirements.

gammaCorr= vision.ChromaResampler(Name,Value)sets properties using one or more name-value pairs. Enclose each property name in quotes. For example,resampler = vision.ChromaResampler('InterpolationFilter','Linear')

Properties

expand all

Unless otherwise indicated, properties arenontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and thereleasefunction unlocks them.

If a property istunable, you can change its value at any time.

For more information on changing property values, seeSystem Design in MATLAB Using System Objects.

Resampling format, specified as 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 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'


Method used to approximate missing values, specified asPixel replicationorLinear. The default isLinear. When you set this property toLinear, the object uses linear interpolation to calculate the missing values. When you set this property toPixel 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.

Lowpass filter used to prevent aliasing, specified asAuto,财产, orNone. When you set this property toAuto, the object uses a built-in lowpass filter. When you set this property to财产, the coefficients of the filters are specified by theHorizontalFilterCoefficientsandVerticalFilterCoefficientsproperties. When you set this property toNone, the object does not filter the input signal. This property applies when you downsample the chrominance values.

横向滤波器系数, specified as a three-element vector. This property applies when you set theResamplingproperty 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 theAntialiasingFilterSourceproperty to财产.

Specify the filter coefficients to apply to the input signal, specifie as a two-element vector. This property applies when you set theResamplingproperty 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 theAntialiasingFilterSourceproperty to财产.

输入行格式, specified astrueorfalse. Set this property totruewhen 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.

Usage

Description

example

[Cb1,Cr1] = resampler(Cb,Cr)resamples the input chrominance components Cb and Cr and returns Cb1 and Cr1, as the resampled outputs.

Input Arguments

expand all

Chrominance component of an image, specified as a matrix.

Chrominance component of an image, specified as a matrix.

Output Arguments

expand all

Chrominance component of an image, returned as a matrix.

Chrominance component of an image, returned as a matrix.

Object Functions

To use an object function, specify the System object™ as the first input argument. For example, to release system resources of a System object namedobj, use this syntax:

release(obj)

expand all

step RunSystem objectalgorithm
release Release resources and allow changes toSystem objectproperty values and input characteristics
reset Reset internal states ofSystem object

Examples

collapse all

Create a resampler object

resampler = vision.ChromaResampler;

Read an RGB image and convert it to YCbCr.

imageRGB = imread('peppers.png'); imageYCbCr = rgb2ycbcr(imageRGB);

Resample the Cb and Cr chrominance components.

[Cb,Cr] = resampler(imageYCbCr(:,:,2), imageYCbCr(:,:,3));

Extended Capabilities

Version History

Introduced in R2012a

See Also