Skip to content

Gamma (dart E)#

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

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

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.

Configuring Gamma Correction#

To configure gamma correction, 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.

Setting the Color Space#

On daA…mci camera modules, the BslColorSpace parameter is available. It 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, the Gamma parameter becomes read-only, and the Gamma parameter value is ignored.

Sample Code#

// Set the Gamma value to 1.2
camera.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);
/* 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 Gamma value to 1.2
camera.Gamma.Value = 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.