Gamma Correction
Apply or remove gamma correction to or from image or video stream
Libraries:
Computer Vision Toolbox /
Conversions
Description
The Gamma Correction block applies or removes gamma correction to or from an image or video stream.
Examples
Ports
Input
I — Input image
matrix | array
Input image, specified as an M-by-N matrix or an M-by-N-by-C array, where C is the number of color channels in the input image.
Dependencies
To enable this port, set the Operation parameter to
Gamma
.
Data Types: single
| double
| int8
| int16
| uint8
| uint16
| Boolean
| fixed point
I' — Gamma-corrected input image
matrix | array
Gamma-corrected input image, specified as an M-by-N matrix or an M-by-N-by-C array, where C is the number of color channels in the input image.
Dependencies
To enable this port, set the Operation parameter to
De-gamma
.
Data Types: single
| double
| int8
| int16
| uint8
| uint16
| Boolean
| fixed point
Output
I' — Gamma-corrected output image
matrix | array
Gamma-corrected output image, returned as an M-by-N matrix or an M-by-N-by-C array, where C is the number of color channels.
Dependencies
To enable this port, set the Operation parameter to
Gamma
.
Data Types: single
| double
| int8
| int16
| uint8
| uint16
| Boolean
| fixed point
I — Gamma-removed output image
matrix | array
Gamma-removed output image, returned as an M-by-N matrix or an M-by-N-by-C array, where C is the number of color channels.
Dependencies
To enable this port, set the Operation parameter to
De-gamma
.
Data Types: single
| double
| int8
| int16
| uint8
| uint16
| Boolean
| fixed point
Parameters
Operation — Block operation
Gamma
(default) | De-gamma
Specify the gamma operation the block performs.
Gamma
— Apply gamma correction to the input image.De-gamma
— Remove gamma correction from the input image.
Gamma — Gamma value
2.2
(default) | scalar
Specify the gamma as a value greater than or equal to 1. A value less than 1 encodes luminance values in image and a value greater than 1 decodes luminance values in image, represented as gamma compression and gamma expansion respectively.
Linear segment — Linear segment
on
(default) | off
Select this parameter to define the gamma curve as a linear segment near the origin. For more information, see Gamma Correction Method.
Break point — Break point value
0.018
(default) | scalar
Specify a scalar break point value, which indicates the I-axis value at the end of the gamma curve linear segment. For more information, see Gamma Correction Method.
Dependencies
To enable this parameter, select the Linear segment parameter.
Block Characteristics
Algorithms
Gamma Correction Method
For input signals normalized between 0 and 1, gamma correction is defined by these equations. For integers and fixed-point data types, these equations are generalized by applying scaling and offset values specific to each data type.
SLS is the slope of the straight line segment. BP is the break point of the straight line segment, which corresponds to the Break point parameter. FS is the slope-matching factor, which matches the slope of the linear segment to the slope of the power function segment. CO is the segment offset, which ensures that the linear segment and the power function segments connect. This figure shows the slope of the straight line segment SLS and break point of the straight line segment BP for gamma and de-gamma operations.
By linearizing the input normalized signal, the block removes gamma correction as defined by this equation.
Typical gamma values range from 1 to 3. Most LCD monitor gamma values range from 1.8 to 2.2. Check with the manufacturer of your hardware to obtain its gamma value. This table shows the gamma function parameters for different standards.
Standard | Slope | Break Point | Gamma |
---|---|---|---|
CIE L* | 9.033 | 0.008856 | 3 |
Recommendation ITU-R BT.709-3, Parameter Values for the HDTV Standards for Production and International Programme Exchange | 4.5 | 0.018 | |
sRGB | 12.92 | 0.00304 | 2.4 |
References
[1] Poynton, Charles A. Digital Video and HDTV: Algorithms and Interfaces. Morgan Kaufmann Series in Computer Graphics and Geometric Modeling. Amsterdam ; Boston: Morgan Kaufmann Publishers, 2003.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)