Skip to content

Gamma#

The Gamma camera feature allows you to optimize the brightness of acquired images for display on a monitor.

Using the Feature#

Prerequisites#

  • For best results, set the black level to 0 (zero) before you adjust gamma.
  • If the GammaEnable parameter is available, it must be set to true.

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):

Gamma Correction Formula (Red Pixels)

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, use the Gamma parameter. 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.

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: 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. An additional gamma correction value of approximately 0.4 is applied. (Default.)
      The sRGB gamma correction value is applied separately and will not be included in the Gamma parameter value.
      Example: You have set the color space mode to sRGB and the Gamma 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.
  • BslColorSpace: Allows you to select one of the following gamma correction modes:
    • Off: No additional gamma correction value is applied. (Default.)
    • sRGB: The image brightness is optimized for display on an sRGB monitor. An additional gamma correction value of approximately 0.4 is applied. (Default.)
      The sRGB gamma correction value is applied separately and will not be included in the Gamma parameter value.
      Example: You have set the color space mode to sRGB and the Gamma 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 BslColorSpace to sRGB will also affect the Balance White, Color Adjustment, and Color Transformation features.

Specifics#

Show all camera models

Camera Model Additional Parameters
a2A1920-51gcBAS BslColorSpacea
a2A1920-51gcPRO BslColorSpacea
a2A1920-51gmBAS BslColorSpacea
a2A1920-51gmPRO BslColorSpacea
a2A1920-160ucBAS BslColorSpacea
a2A1920-160ucPRO BslColorSpacea
a2A1920-160umBAS BslColorSpacea
a2A1920-160umPRO BslColorSpacea
a2A3840-13gcBAS BslColorSpacea
a2A3840-13gmBAS BslColorSpacea
a2A3840-45ucBAS BslColorSpacea
a2A3840-45umBAS BslColorSpacea
acA640-90gc GammaEnable
GammaSelector
acA640-90gm GammaEnable
GammaSelector
acA640-90uc Nonea
acA640-90um Nonea
acA640-120gc GammaEnable
GammaSelector
acA640-120gm GammaEnable
GammaSelector
acA640-120uc Nonea
acA640-120um Nonea
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
acA780-75gc GammaEnable
GammaSelector
acA780-75gm GammaEnable
GammaSelector
acA800-200gc GammaEnable
GammaSelector
acA800-200gm GammaEnable
GammaSelector
acA800-510uc Nonea
acA800-510um Nonea
acA1280-60gc GammaEnable
GammaSelector
acA1280-60gm GammaEnable
GammaSelector
acA1300-22gc GammaEnable
GammaSelector
acA1300-22gm GammaEnable
GammaSelector
acA1300-30gc GammaEnable
GammaSelector
acA1300-30gm GammaEnable
GammaSelector
acA1300-30uc Nonea
acA1300-30um Nonea
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-20gm GammaEnable
GammaSelector
acA1600-20uc Nonea
acA1600-20um 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-50gmNIR GammaEnable
GammaSelector
acA2000-165uc Nonea
acA2000-165um Nonea
acA2000-165umNIR 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-57um 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
acA4600-7gc GammaEnable
GammaSelector
acA4600-10uc Nonea
acA5472-5gc GammaEnable
GammaSelector
acA5472-5gm GammaEnable
GammaSelector
acA5472-17uc Nonea
acA5472-17um Nonea
boA4096-93cc BslColorSpacea
boA4096-93cm BslColorSpacea
boA4112-68cc BslColorSpacea
boA4112-68cm BslColorSpacea
daA1280-54lc BslColorSpaceModeb
daA1280-54lm BslColorSpaceModeb
daA1280-54uc BslColorSpaceModeb
daA1280-54um BslColorSpaceModeb
daA1600-60lc BslColorSpaceModeb
daA1600-60lm BslColorSpaceModeb
daA1600-60uc BslColorSpaceModeb
daA1600-60um BslColorSpaceModeb
daA1920-15um BslColorSpaceModeb
daA1920-30uc BslColorSpaceModeb
daA1920-30um BslColorSpaceModeb
daA2500-14lc BslColorSpaceModeb
daA2500-14lm BslColorSpaceModeb
daA2500-14uc BslColorSpaceModeb
daA2500-14um BslColorSpaceModeb
daA2500-60mc Gamma feature not supported
puA1280-54uc BslColorSpaceModeb
puA1280-54um BslColorSpaceModeb
puA1600-60uc BslColorSpaceModeb
puA1600-60um BslColorSpaceModeb
puA1920-30uc BslColorSpaceModeb
puA1920-30um BslColorSpaceModeb
puA2500-14uc BslColorSpaceModeb
puA2500-14um BslColorSpaceModeb

  1. 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 will not be included in the Gamma parameter value. Example: You have set the light source preset to Tungsten and the Gamma 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.

  2. Only available if the pixel format is set to YCbCr422 or RGB8.

Sample Code#

ace classic/U/L GigE Cameras#

// Enable the Gamma feature
camera.GammaEnable.SetValue(true);
// Set the gamma type to User
camera.GammaSelector.SetValue(GammaSelector_User);
// Set the Gamma value to 1.2
camera.Gamma.SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the Gamma feature
CBooleanPtr(nodemap.GetNode("GammaEnable"))->SetValue(true);
// Set the gamma type to User
CEnumerationPtr(nodemap.GetNode("GammaSelector"))->FromString("User");
// Set the Gamma value to 1.2
CFloatPtr(nodemap.GetNode("Gamma"))->SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the Gamma feature
CBooleanParameter(nodemap, "GammaEnable").SetValue(true);
// Set the gamma type to User
CEnumParameter(nodemap, "GammaSelector").SetValue("User");
// Set the Gamma value to 1.2
CFloatParameter(nodemap, "Gamma").SetValue(1.2);
// Enable the Gamma feature
camera.Parameters[PLCamera.GammaEnable].SetValue(true);
// Set the gamma type to User
camera.Parameters[PLCamera.GammaSelector].SetValue(PLCamera.GammaSelector.User);
// Set the Gamma value to 1.2
camera.Parameters[PLCamera.Gamma].SetValue(1.2);
// Enable the Gamma feature
Pylon.DeviceSetBooleanFeature(hdev, "GammaEnable", true);
// Set the gamma type to User
Pylon.DeviceFeatureFromString(hdev, "GammaSelector", "User");
// Set the Gamma value to 1.2
Pylon.DeviceSetFloatFeature(hdev, "Gamma", 1.2);
/* 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#

// Set the Gamma value to 1.2
camera.Gamma.SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Gamma value to 1.2
CFloatPtr(nodemap.GetNode("Gamma"))->SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Gamma value to 1.2
CFloatParameter(nodemap, "Gamma").SetValue(1.2);
// Set the Gamma value to 1.2
camera.Parameters[PLCamera.Gamma].SetValue(1.2);
// Set the Gamma value to 1.2
Pylon.DeviceSetFloatFeature(hdev, "Gamma", 1.2);
/* 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);

You can also use the pylon Viewer to easily set the parameters.