Main Content

Gamma Corrector

Apply or remove gamma correction of pixel stream

  • Gamma Corrector block

Libraries:
Vision HDL Toolbox / Conversions

Description

Gamma Corrector applies or removes gamma correction on a stream of pixels. Gamma correction adjusts linear pixel values so that the modified values fit a curve. The de-gamma operation performs the opposite operation to obtain linear pixel values.

Examples

Ports

This block uses a streaming pixel interface with a bus for frame control signals. This interface enables the block to operate independently of image size and format. The pixel ports on this block support single pixel streaming or multipixel streaming. Single pixel streaming accepts and returns a single pixel value each clock cycle. Multipixel streaming accepts and returns a vector of M pixels per clock cycle to support high-frame-rate or high-resolution formats. The M value corresponds to the Number of pixels parameter of the Frame To Pixels block. Along with the pixel, the block accepts and returns a pixelcontrol bus that contains five control signals. The control signals indicate the validity of each pixel and their location in the frame. For multipixel streaming, one set of control signals applies to all pixels in the vector. 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.

Input

expand all

For single pixel streams, specify pixel as a scalar intensity value. For multipixel streams, specify pixel as a vector of Number of pixels-by-1 pixel intensity values. Number of pixels can be two, four, or eight. Integer and fixed-point data types larger than 16 bits are not supported.

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

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

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

Image pixel, returned as a scalar value or vector of values. The data type and dimension of the output pixel stream match those of the input pixel stream.

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

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

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

Direction of pixel value adjustment, specified as one of these options:

  • Gamma — Apply gamma correction.

  • De-gamma — Remove gamma correction.

Target gamma value, specified as a scalar greater than or equal to 1.

  • When you set Operation to Gamma, Gamma is the target gamma value of the output video stream.

  • When you set Operation to De-gamma, Gamma is the gamma value of the input video stream.

Option to include a linear segment in the gamma curve. When you select this check box, the gamma curve has a linear portion near the origin.

Pixel value that corresponds to the point where the gamma curve and linear segment meet, specified as a scalar value between 0 and 1, exclusive.

Dependencies

This parameter applies only when you select the Linear segment check box.

Algorithms

expand all

For the equations used for gamma correction, see Gamma Correction (Computer Vision Toolbox) in the Computer Vision Toolbox™ documentation.

To save hardware resources, the block implements the gamma correction equation as a lookup table. The lookup table maps each input pixel value to a corrected output value.

Extended Capabilities

Version History

Introduced in R2015a

expand all

See Also

Blocks

Objects