Main Content

Color Space Converter

Convert color information between color spaces

  • Color Space Converter block

Libraries:
Vision HDL Toolbox / Conversions

Description

The Color Space Converter block converts between R'G'B' and Y'CbCr color spaces, and also converts R'G'B' to intensity.

Note

The Color Space Converter block operates on gamma-corrected color spaces, usually indicated with prime notation ('). However, for simplicity, the block and mask labels do not include the prime notation.

Examples

Ports

This block uses a streaming pixel interface with a pixelcontrol bus for frame control signals. This interface enables the block to operate independently of image size and format. All Vision HDL Toolbox™ blocks use the same streaming interface. The block accepts and returns a scalar pixel value and a bus that contains five control signals. The control signals indicate the validity of each pixel and its location in the frame. To convert a frame (pixel matrix) into a serial pixel stream and control signals, use the Frame To Pixels block. For a full description of the interface, see Streaming Pixel Interface.

This block also supports multipixel streams, where the pixel input is a matrix of M-by-3 values. M is the number of pixels and each pixel has 3 R'G'B' or Y'CbCr components. These values correspond to the Number of pixels and Number of components parameters of the Frame To Pixels block.

Input

expand all

For scalar pixel streams, specify pixel as a vector of 1-by-3 values. For multipixel streams, specify pixel as a matrix of Number of pixels-by-3 pixel intensity values. Number of pixels can be two, four, or eight.

The pixel stream must be in Y'CbCr or R'G'B' color space. Integer and fixed-point data types must be between 8 and 16 bits.

The software supports double and single data types for simulation, but not for HDL code generation.

Data Types: single | double | uint8 | uint16 | fixed point

The pixelcontrol bus contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

For multipixel streaming, each vector of pixel values has one set of control signals. Because the vector has only one valid signal, the pixels in the vector must be either all valid or all invalid. The hStart and vStart signals apply to the pixel with the lowest index in the vector. The hEnd and vEnd signals apply to the pixel with the highest index in the vector.

Data Types: bus

Output

expand all

Output pixel stream in intensity, Y'CbCr, or R'G'B' color space, returned as a single pixel stream or multipixel stream. The data type and Number of pixels of the output stream is the same as the input pixel stream. If the output is intensity values, each pixel has one component. If the output is Y'CbCr or R'G'B', each pixel has three components.

The software supports double and single data types for simulation, but not for HDL code generation.

Data Types: single | double | uint8 | uint16 | fixed point

The pixelcontrol bus contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

For multipixel streaming, each vector of pixel values has one set of control signals. Because the vector has only one valid signal, the pixels in the vector must be either all valid or all invalid. The hStart and vStart signals apply to the pixel with the lowest index in the vector. The hEnd and vEnd signals apply to the pixel with the highest index in the vector.

Data Types: bus

Parameters

expand all

The block accepts input pixels as vectors of three values that represent a single pixel. If you choose RGB to intensity, each output pixel is a scalar. Otherwise, each output pixel is a vector of three values.

Conversion equation used between R'G'B' and Y'CbCr color spaces.

Dependencies

This parameter applies only when you set Conversion to RGB to YCbCr or YCbCr to RGB.

Scanning standard used to convert between R'G'B' and Y'CbCr color spaces in HDTV format.

Dependencies

This parameter applies when you set Use conversion specified by to Rec. 709 (HDTV).

Algorithms

expand all

When you use multipixel streaming, the block replicates the conversion algorithm for each of the M input pixels, in parallel. This increase in hardware resources is a trade off for increasing throughput compared to single-pixel streaming.

Extended Capabilities

Version History

Introduced in R2015a

expand all