Gamma#
Using the Feature#
How It Works#
The camera applies a gamma correction value (γ) to the brightness value of each pixel according to the following formula (red pixel value (R) of a color camera shown as an example):
The maximum pixel value (Rmax) equals, e.g., 255 for 8-bit pixel formats or 1 023 for 10-bit pixel formats.
Enabling Gamma Correction#
To enable gamma correction:
- Set the
GammaEnable
parameter totrue
(if available). - For best results, set the
BlackLevel
parameter to 0. - Set the
Gamma
parameter to the desired value. The parameter's value range is 0 to ≈4.- Gamma = 1: The overall brightness remains unchanged.
- Gamma < 1: The overall brightness increases.
- Gamma > 1: The overall brightness decreases.
In all cases, black pixels (brightness = 0) and white pixels (brightness = maximum) will not be adjusted.
Info
- If you enable gamma correction and the pixel format is set to a 12-bit pixel format, some image information will be lost. Pixel data output will still be 12-bit, but the pixel values will be interpolated during the gamma correction process.
- On boA13440-17cm cameras, gamma correction can only be enabled, if the pixel format is set to an 8-bit pixel format.
Additional Parameters#
Depending on your camera model, the following additional parameters are available:
GammaEnable
: Enables or disables gamma correction.GammaSelector
: Allows you to select one of the following gamma correction modes:User
: The gamma correction value can be set as desired. (Default.)sRGB
: The camera automatically sets a gamma correction value of approximately 0.4. This value is optimized for image display on sRGB monitors.
BslColorSpaceMode
orBslColorSpace
: Allows you to select one of the following gamma correction modes:RGB
: No additional gamma correction value is applied.sRGB
: The image brightness is optimized for display on an sRGB monitor. A gamma correction value of approximately 0.4 is applied. For more information, see the footnotes in the Specifics section.
Specifics#
Camera Model | Additional Parameters |
---|---|
a2A640-240gmSWIR | None |
a2A640-240umSWIR | None |
a2A1280-80gmSWIR | None |
a2A1280-125umSWIR | None |
a2A1920-51gcBAS | BslColorSpacec |
a2A1920-51gcPRO | BslColorSpacec |
a2A1920-51gmBAS | None |
a2A1920-51gmPRO | None |
a2A1920-160ucBAS | BslColorSpacec |
a2A1920-160ucPRO | BslColorSpacec |
a2A1920-160umBAS | None |
a2A1920-160umPRO | None |
a2A1920-165g5cBAS | BslColorSpacec |
a2A1920-165g5mBAS | None |
a2A2048-35gmSWIR | None |
a2A2048-110umSWIR | None |
a2A2440-98g5cBAS | BslColorSpacec |
a2A2440-98g5mBAS | None |
a2A2448-23gcBAS | BslColorSpacec |
a2A2448-23gcPRO | BslColorSpacec |
a2A2448-23gmBAS | None |
a2A2448-23gmPRO | None |
a2A2448-75ucBAS | BslColorSpacec |
a2A2448-75ucPRO | BslColorSpacec |
a2A2448-75umBAS | None |
a2A2448-75umPRO | None |
a2A2448-105g5cBAS | BslColorSpacec |
a2A2448-105g5mBAS | None |
a2A2448-120cc | BslColorSpacec |
a2A2448-120cm | None |
a2A2448-210cc | BslColorSpacec |
a2A2448-210cm | None |
a2A2560-20gmSWIR | None |
a2A2560-70umSWIR | None |
a2A2590-22gcBAS | BslColorSpacec |
a2A2590-22gcPRO | BslColorSpacec |
a2A2590-22gmBAS | None |
a2A2590-22gmPRO | None |
a2A2590-60ucBAS | BslColorSpacec |
a2A2590-60ucPRO | BslColorSpacec |
a2A2590-60umBAS | None |
a2A2590-60umPRO | None |
a2A2600-20gcBAS | BslColorSpacec |
a2A2600-20gcPRO | BslColorSpacec |
a2A2600-20gmBAS | None |
a2A2600-20gmPRO | None |
a2A2600-64ucBAS | BslColorSpacec |
a2A2600-64ucPRO | BslColorSpacec |
a2A2600-64umBAS | None |
a2A2600-64umPRO | None |
a2A2840-14gcBAS | BslColorSpacec |
a2A2840-14gcPRO | BslColorSpacec |
a2A2840-14gmBAS | None |
a2A2840-14gmPRO | None |
a2A2840-14gmUV | None |
a2A2840-48ucBAS | BslColorSpacec |
a2A2840-48ucPRO | BslColorSpacec |
a2A2840-48umBAS | None |
a2A2840-48umPRO | None |
a2A2840-48umUV | None |
a2A2840-67g5cBAS | BslColorSpacec |
a2A2840-67g5mBAS | None |
a2A2840-67g5mUV | None |
a2A2840-86cc | BslColorSpacec |
a2A2840-86cm | None |
a2A3840-13gcBAS | BslColorSpacec |
a2A3840-13gcPRO | BslColorSpacec |
a2A3840-13gmBAS | None |
a2A3840-13gmPRO | None |
a2A3840-45ucBAS | BslColorSpacec |
a2A3840-45ucPRO | BslColorSpacec |
a2A3840-45umBAS | None |
a2A3840-45umPRO | None |
a2A4096-9gcBAS | BslColorSpacec |
a2A4096-9gcPRO | BslColorSpacec |
a2A4096-9gmBAS | None |
a2A4096-9gmPRO | None |
a2A4096-30ucBAS | BslColorSpacec |
a2A4096-30ucPRO | BslColorSpacec |
a2A4096-30umBAS | None |
a2A4096-30umPRO | None |
a2A4096-44g5cBAS | BslColorSpacec |
a2A4096-44g5mBAS | None |
a2A4096-67cc | BslColorSpacec |
a2A4096-67cm | None |
a2A4200-12gcBAS | BslColorSpacec |
a2A4200-12gcPRO | BslColorSpacec |
a2A4200-12gmBAS | None |
a2A4200-12gmPRO | None |
a2A4200-40ucBAS | BslColorSpacec |
a2A4200-40ucPRO | BslColorSpacec |
a2A4200-40umBAS | None |
a2A4200-40umPRO | None |
a2A4504-5gcBAS | BslColorSpacec |
a2A4504-5gcPRO | BslColorSpacec |
a2A4504-5gmBAS | None |
a2A4504-5gmPRO | None |
a2A4504-18ucBAS | BslColorSpacec |
a2A4504-18ucPRO | BslColorSpacec |
a2A4504-18umBAS | None |
a2A4504-18umPRO | None |
a2A4504-27g5cBAS | BslColorSpacec |
a2A4504-27g5mBAS | None |
a2A4504-42cc | BslColorSpacec |
a2A4504-42cm | None |
a2A4508-6gcBAS | BslColorSpacec |
a2A4508-6gcPRO | BslColorSpacec |
a2A4508-6gmBAS | None |
a2A4508-6gmPRO | None |
a2A4508-20ucBAS | BslColorSpacec |
a2A4508-20ucPRO | BslColorSpacec |
a2A4508-20umBAS | None |
a2A4508-20umPRO | None |
a2A5320-7gcBAS | BslColorSpacec |
a2A5320-7gcPRO | BslColorSpacec |
a2A5320-7gmBAS | None |
a2A5320-7gmPRO | None |
a2A5320-23ucBAS | BslColorSpacec |
a2A5320-23ucPRO | BslColorSpacec |
a2A5320-23umBAS | None |
a2A5320-23umPRO | None |
a2A5320-34g5cBAS | BslColorSpacec |
a2A5320-34g5mBAS | None |
a2A5320-52cc | BslColorSpacec |
a2A5320-52cm | None |
a2A5328-4gcBAS | BslColorSpacec |
a2A5328-4gcPRO | BslColorSpacec |
a2A5328-4gmBAS | None |
a2A5328-4gmPRO | None |
a2A5328-15ucBAS | BslColorSpacec |
a2A5328-15ucPRO | BslColorSpacec |
a2A5328-15umBAS | None |
a2A5328-15umPRO | None |
a2A5328-22g5cBAS | BslColorSpacec |
a2A5328-22g5mBAS | None |
a2A5328-35cc | BslColorSpacec |
a2A5328-35cm | None |
acA640-121gm | GammaEnable GammaSelector |
acA640-300gc | GammaEnable GammaSelector |
acA640-300gm | GammaEnable GammaSelector |
acA640-750uc | Nonea |
acA640-750um | Nonea |
acA720-290gc | GammaEnable GammaSelector |
acA720-290gm | GammaEnable GammaSelector |
acA720-520uc | Nonea |
acA720-520um | Nonea |
acA800-200gc | GammaEnable GammaSelector |
acA800-200gm | GammaEnable GammaSelector |
acA800-510uc | Nonea |
acA800-510um | Nonea |
acA1280-60gc | GammaEnable GammaSelector |
acA1280-60gm | GammaEnable GammaSelector |
acA1300-60gc | GammaEnable GammaSelector |
acA1300-60gm | GammaEnable GammaSelector |
acA1300-60gmNIR | GammaEnable GammaSelector |
acA1300-75gc | GammaEnable GammaSelector |
acA1300-75gm | GammaEnable GammaSelector |
acA1300-200uc | Nonea |
acA1300-200um | Nonea |
acA1440-73gc | GammaEnable GammaSelector |
acA1440-73gm | GammaEnable GammaSelector |
acA1440-220uc | Nonea |
acA1440-220um | Nonea |
acA1600-20gc | GammaEnable GammaSelector |
acA1600-20uc | Nonea |
acA1600-60gc | GammaEnable GammaSelector |
acA1600-60gm | GammaEnable GammaSelector |
acA1920-25gc | GammaEnable GammaSelector |
acA1920-25gm | GammaEnable GammaSelector |
acA1920-25uc | Nonea |
acA1920-25um | Nonea |
acA1920-40gc | GammaEnable GammaSelector |
acA1920-40gm | GammaEnable GammaSelector |
acA1920-40uc | Nonea |
acA1920-40ucMED | Nonea |
acA1920-40um | Nonea |
acA1920-40umMED | Nonea |
acA1920-48gc | GammaEnable GammaSelector |
acA1920-48gm | GammaEnable GammaSelector |
acA1920-50gc | GammaEnable GammaSelector |
acA1920-50gm | GammaEnable GammaSelector |
acA1920-150uc | Nonea |
acA1920-150um | Nonea |
acA1920-155uc | Nonea |
acA1920-155ucMED | Nonea |
acA1920-155um | Nonea |
acA1920-155umMED | Nonea |
acA2000-50gc | GammaEnable GammaSelector |
acA2000-50gm | GammaEnable GammaSelector |
acA2000-165uc | Nonea |
acA2000-165um | Nonea |
acA2040-25gc | GammaEnable GammaSelector |
acA2040-25gm | GammaEnable GammaSelector |
acA2040-25gmNIR | GammaEnable GammaSelector |
acA2040-35gc | GammaEnable GammaSelector |
acA2040-35gm | GammaEnable GammaSelector |
acA2040-55uc | Nonea |
acA2040-55um | Nonea |
acA2040-90uc | Nonea |
acA2040-90um | Nonea |
acA2040-90umNIR | Nonea |
acA2040-120uc | Nonea |
acA2040-120um | Nonea |
acA2440-20gc | GammaEnable GammaSelector |
acA2440-20gm | GammaEnable GammaSelector |
acA2440-35uc | Nonea |
acA2440-35ucMED | Nonea |
acA2440-35um | Nonea |
acA2440-35umMED | Nonea |
acA2440-75uc | Nonea |
acA2440-75ucMED | Nonea |
acA2440-75um | Nonea |
acA2440-75umMED | Nonea |
acA2500-14gc | GammaEnable GammaSelector |
acA2500-14gm | GammaEnable GammaSelector |
acA2500-14uc | Nonea |
acA2500-14um | Nonea |
acA2500-20gc | GammaEnable GammaSelector |
acA2500-20gcMED | GammaEnable GammaSelector |
acA2500-20gm | GammaEnable GammaSelector |
acA2500-20gmMED | GammaEnable GammaSelector |
acA2500-60uc | Nonea |
acA2500-60um | Nonea |
acA3088-16gc | GammaEnable GammaSelector |
acA3088-16gm | GammaEnable GammaSelector |
acA3088-57uc | Nonea |
acA3088-57ucMED | Nonea |
acA3088-57um | Nonea |
acA3088-57umMED | Nonea |
acA3800-10gc | GammaEnable GammaSelector |
acA3800-10gm | GammaEnable GammaSelector |
acA3800-14uc | Nonea |
acA3800-14um | Nonea |
acA4024-8gc | GammaEnable GammaSelector |
acA4024-8gm | GammaEnable GammaSelector |
acA4024-29uc | Nonea |
acA4024-29um | Nonea |
acA4096-11gc | GammaEnable GammaSelector |
acA4096-11gm | GammaEnable GammaSelector |
acA4096-30uc | Nonea |
acA4096-30ucMED | Nonea |
acA4096-30um | Nonea |
acA4096-30umMED | Nonea |
acA4096-40uc | Nonea |
acA4096-40ucMED | Nonea |
acA4096-40um | Nonea |
acA4096-40umMED | Nonea |
acA4112-8gc | GammaEnable GammaSelector |
acA4112-8gm | GammaEnable GammaSelector |
acA4112-20uc | Nonea |
acA4112-20ucMED | Nonea |
acA4112-20um | Nonea |
acA4112-20umMED | Nonea |
acA4112-30uc | Nonea |
acA4112-30ucMED | Nonea |
acA4112-30um | Nonea |
acA4112-30umMED | Nonea |
acA5472-5gc | GammaEnable GammaSelector |
acA5472-5gm | GammaEnable GammaSelector |
acA5472-17uc | Nonea |
acA5472-17ucMED | Nonea |
acA5472-17um | Nonea |
acA5472-17umMED | Nonea |
boA1936-400cc | BslColorSpacec |
boA1936-400cm | None |
boA2448-250cc | BslColorSpacec |
boA2448-250cm | None |
boA2832-190cc | BslColorSpacec |
boA2832-190cm | None |
boA4096-93cc | BslColorSpacec |
boA4096-93cm | None |
boA4096-180cc | BslColorSpacec |
boA4096-180cm | None |
boA4112-68cc | BslColorSpacec |
boA4112-68cm | None |
boA4500-45cc | BslColorSpacec |
boA4500-45cm | None |
boA4504-100cc | BslColorSpacec |
boA4504-100cm | None |
boA5120-150cc | Gamma feature not supported |
boA5120-150cm | Gamma feature not supported |
boA5120-230cc | Gamma feature not supported |
boA5120-230cm | Gamma feature not supported |
boA5320-150cc | BslColorSpacec |
boA5320-150cm | None |
boA5328-100cc | BslColorSpacec |
boA5328-100cm | None |
boA6500-36cc | BslColorSpacec |
boA6500-36cm | None |
boA8100-16cc | BslColorSpacec |
boA8100-16cm | None |
boA9344-30cc | Gamma feature not supported |
boA9344-30cm | Gamma feature not supported |
boA9344-70cc | Gamma feature not supported |
boA9344-70cm | Gamma feature not supported |
boA13440-17cm | None |
daA720-520uc | BslColorSpacea |
daA720-520um | None |
daA1280-54uc | BslColorSpaceModeb |
daA1280-54um | None |
daA1440-220uc | BslColorSpacea |
daA1440-220um | None |
daA1600-60uc | BslColorSpaceModeb |
daA1600-60um | None |
daA1920-15um | None |
daA1920-30uc | BslColorSpaceModeb |
daA1920-30um | None |
daA1920-160uc | BslColorSpacea |
daA1920-160um | None |
daA2448-70uc | BslColorSpacea |
daA2448-70um | None |
daA2500-14uc | BslColorSpaceModeb |
daA2500-14um | None |
daA3840-45uc | BslColorSpacea |
daA3840-45um | None |
dmA720-290gc | BslColorSpacec |
dmA720-290gm | None |
dmA1440-73gc | BslColorSpacec |
dmA1440-73gm | None |
dmA1920-51gc | BslColorSpacec |
dmA1920-51gm | None |
puA1280-54uc | BslColorSpaceModeb |
puA1280-54um | None |
puA1600-60uc | BslColorSpaceModeb |
puA1600-60um | None |
puA1920-30uc | BslColorSpaceModeb |
puA1920-30um | None |
puA2500-14uc | BslColorSpaceModeb |
puA2500-14um | None |
r2L2048-29gc | BslColorSpacec |
r2L2048-58gm | None |
r2L2048-62cc | BslColorSpacec |
r2L2048-62g5c | BslColorSpacec |
r2L2048-172cm | None |
r2L2048-172g5m | None |
r2L4096-14gc | BslColorSpacec |
r2L4096-29gm | None |
r2L4096-42cc | BslColorSpacec |
r2L4096-42g5c | BslColorSpacec |
r2L4096-84cm | None |
r2L4096-84g5m | None |
r2L8192-200cm | None |
r2L16384-120cm | None |
-
If you select a light source preset, an additional gamma correction value of approximately 0.4 is applied (sRGB gamma correction). This value is applied separately and not included in the
Gamma
parameter value. Example: You have set the light source preset to Tungsten and theGamma
parameter value to 1.2. First, an automatic correction value of approximately 0.4 is applied to the pixel values. After that, a gamma correction value of 1.2 is applied to the resulting pixel values. -
Only available if the pixel format is set to YCbCr422 or RGB8.
-
If the color space is set to
sRGB
, a gamma correction value of approximately 0.4 is applied. This value is applied separately and not included in theGamma
parameter value. Example: You set the color space to sRGB and theGamma
parameter to 1.2. First, an automatic correction value of approximately 0.4 is applied to the pixel values. After that, a gamma correction value of 1.2 is applied to the resulting pixel values.
If you have selected a Light Source Preset, setting the color space tosRGB
will also affect the Balance White, Color Adjustment, and Color Transformation features. -
If the color space is set to
sRGB
, a gamma correction value of approximately 0.4 is applied, theGamma
parameter becomes read-only, and theGamma
parameter value is ignored.
Sample Code#
ace 2, boost, and dart R Cameras#
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK; /* Return value of pylon methods */
/* Set the Gamma value to 1.2 */
errRes = PylonDeviceSetFloatFeature(hdev, "Gamma", 1.2);
CHECK(errRes);
/* Set the color space to sRGB */
errRes = PylonDeviceFeatureFromString(hdev, "BslColorSpace", "sRGB");
CHECK(errRes);
ace Classic/U/L GigE Cameras#
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK; /* Return value of pylon methods */
/* Enable the Gamma feature */
errRes = PylonDeviceSetBooleanFeature(hdev, "GammaEnable", 1);
CHECK(errRes);
/* Set the gamma type to User */
errRes = PylonDeviceFeatureFromString(hdev, "GammaSelector", "User");
CHECK(errRes);
/* Set the Gamma value to 1.2 */
errRes = PylonDeviceSetFloatFeature(hdev, "Gamma", 1.2);
CHECK(errRes);
Other Cameras#
You can also use the pylon Viewer to easily set the parameters.