Chroma Resampling

Downsample or upsample chrominance components of images

Library

Conversions

visionconversions

  • Chroma Resampling block

Description

The Chroma Resampling block downsamples or upsamples chrominance components of pixels to reduce the bandwidth required for transmission or storage of a signal.

PortInput/OutputSupported Data TypesComplex Values Supported

Cb

Matrix that represents one chrominance component of an image

  • Double-precision floating point

  • Single-precision floating point

  • 8-bit unsigned integer

No

Cr

Matrix that represents one chrominance component of an image

Same as Cb port

No

The data type of the output signals is the same as the data type of the input signals.

Chroma Resampling Formats

The Chroma Resampling block supports the formats shown in the following diagram.

Downsampling

If, for the Resampling parameter, you select 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), or 4:2:2 to 4:2:0 (MPEG2), the block performs a downsampling operation. When the block downsamples from one format to another, it can bandlimit the input signal by applying a lowpass filter to prevent aliasing.

If, for the Antialiasing filter parameter, you select Default, the block uses a built-in lowpass filter to prevent aliasing.

If, for the Resampling parameter, you select 4:4:4 to 4:2:2, 4:4:4 to 4:2:0 (MPEG1), 4:4:4 to 4:2:0 (MPEG2), or 4:4:4 to 4:1:1 and, for the Antialiasing filter parameter, you select User-defined, the Horizontal filter coefficients parameter appears on the dialog box. Enter the filter coefficients to apply to your input.

If, for the Resampling parameter, you select 4:4:4 to 4:2:0 (MPEG1), 4:4:4 to 4:2:0 (MPEG2), 4:2:2 to 4:2:0 (MPEG1), or 4:2:2 to 4:2:0 (MPEG2) and, for the Antialiasing filter parameter, you select User-defined. Vertical filter coefficients parameters appear on the dialog box. Enter an even number of filter coefficients to apply to your input signal.

If, for the Antialiasing filter parameter, you select None, the block does not filter the input signal.

Upsampling

If, for the Resampling parameter, you select 4:2:2 to 4:4:4, 4:2:0 (MPEG1) to 4:2:2, 4:2:0 (MPEG1) to 4:4:4, 4:2:0 (MPEG2) to 4:2:2, 4:2:0 (MPEG2) to 4:4:4, or 4:1:1 to 4:4:4, the block performs an upsampling operation.

When the block upsamples from one format to another, it uses interpolation to approximate the missing chrominance values. If, for the Interpolation parameter, you select Linear, the block uses linear interpolation to calculate the missing values. If, for the Interpolation parameter, you select Pixel replication, the block replicates the chrominance values of the neighboring pixels to create the upsampled image.

Row-Major Data Format

The MATLAB® environment and the Computer Vision Toolbox™ software use column-major data organization. However, the Chroma Resampling block gives you the option to process data that is stored in row-major format. When you select the Input image is transposed (data order is row major) check box, the block assumes that the input buffer contains contiguous data elements from the first row first, then data elements from the second row second, and so on through the last row. Use this functionality only when you meet all the following criteria:

  • You are developing algorithms to run on an embedded target that uses the row-major format.

  • You want to limit the additional processing required to take the transpose of signals at the interfaces of the row-major and column-major systems.

When you use the row-major functionality, you must consider the following issues:

  • When you select this check box, the signal dimensions of the Chroma Resampling block's input are swapped.

  • All the Computer Vision Toolbox blocks can be used to process data that is in the row-major format, but you need to know the image dimensions when you develop your algorithms.

    For example, if you use the 2-D FIR Filter block, you need to verify that your filter coefficients are transposed. If you are using the Rotate block, you need to use negative rotation angles, etc.

  • Only three blocks have the Input image is transposed (data order is row major) check box. They are the Chroma Resampling, Deinterlacing, and Insert Text blocks. You need to select this check box to enable row-major functionality in these blocks. All other blocks must be properly configured to process data in row-major format.

Use the following two-step workflow to develop algorithms in row-major format to run on an embedded target.

Parameters

Resampling

Specify the resampling format.

Antialiasing filter

Specify the lowpass filter that the block uses to prevent aliasing. If you select Default, the block uses a built-in lowpass filter. If you select User-defined, the Horizontal filter coefficients and/or Vertical filter coefficients parameters appear on the dialog box. If you select None, the block does not filter the input signal. This parameter is visible when you are downsampling the chrominance values.

Horizontal filter coefficients

Enter the filter coefficients to apply to your input signal. This parameter is visible if, for the Resampling parameter, you select 4:4:4 to 4:2:2, 4:4:4 to 4:2:0 (MPEG1), 4:4:4 to 4:2:0 (MPEG2), or 4:4:4 to 4:1:1 and, for the Antialiasing filter parameter, you select User-defined.

Vertical filter coefficients

Enter the filter coefficients to apply to your input signal. This parameter is visible if, for the Resampling parameter, you select 4:4:4 to 4:2:0 (MPEG1), 4:4:4 to 4:2:0 (MPEG2), 4:2:2 to 4:2:0 (MPEG1), or 4:2:2 to 4:2:0 (MPEG2) and, for the Antialiasing filter parameter, you select User-defined.

Interpolation

Specify the interpolation method that the block uses to approximate the missing chrominance values. If you select Linear, the block uses linear interpolation to calculate the missing values. If you select Pixel replication, the block replicates the chrominance values of the neighboring pixels to create the upsampled image. This parameter is visible when you are upsampling the chrominance values. This parameter is visible if the Resampling parameter is set to 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 , or 4:2:0  (MPEG2) to 4:2:2 .

Input image is transposed (data order is row major)

When you select this check box, the block assumes that the input buffer contains data elements from the first row first, then data elements from the second row second, and so on through the last row.

References

[1] Haskell, Barry G., Atul Puri, and Arun N. Netravali. Digital Video: An Introduction to MPEG-2. New York: Chapman & Hall, 1996.

[2] Recommendation ITU-R BT.601-5, Studio Encoding Parameters of Digital Television for Standard 4:3 and Wide Screen 16:9 Aspect Ratios.

[3] Wang, Yao, Jorn Ostermann, Ya-Qin Zhang. Video Processing and Communications. Upper Saddle River, NJ: Prentice Hall, 2002.

See Also

Autothreshold

Computer Vision Toolbox software

Color Space Conversion

Computer Vision Toolbox software

Image Complement

Computer Vision Toolbox software

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced before R2006a