Skip to content

Brightness and Contrast (dart E)#

The Brightness and Contrast camera feature allows you to adjust the tonal values of your images.

Brightness and contrast are always processed together as parts of a common mathematical Brightness/Contrast function.

Using the Feature#

Adjusting Contrast#

To adjust the contrast, enter a value for the BslContrast parameter. The parameter's value range is from -1 to 1. By default, the parameter is set to 0 which means that the contrast remains unchanged.

Adjusting Brightness#

To adjust the brightness, enter a value for the BslBrightness parameter. The parameter's value range is from -1 to 1. By default, the parameter is set to 0 which means that the brightness remains unchanged.

How It Works#

Contrast#

Adjusting the contrast changes the degree of difference between light and dark areas in the image. The more contrast you apply, the more pronounced the difference will be.

The camera uses an S-curve function to adjust the contrast.

This allows you to improve the perceived contrast while preserving the dynamic range of the image.

The more you increase the contrast, the more S-shaped the graph of the function will be:

Contrast = 0.3, Brightness = 0, S-Curve Contrast Mode

Contrast = 0.5, Brightness = 0, S-Curve Contrast Mode

The figures above show that increasing the contrast in S-Curve mode has the following effects:

  • The S-curve gets flatter around its starting and end points and steeper around the center. As a result, contrast in light and dark areas of the image is reduced, and contrast in mid tones is increased.
  • Low input pixel values are lowered and high input pixel values are increased. As a result, extreme dark and light areas of your image are compressed, which further improves the perceived contrast.
  • As the curve always starts at (0,0) and ends at (Xmax,Ymax), the dynamic range of the image is preserved.

Contrast settings below 0 in S-Curve mode will result in an inverted S-curve with opposite effects.

Brightness#

Adjusting the brightness allows you to lighten or darken the image by increasing or decreasing its tonal values.

Adjusting the brightness moves the pivot point of the Brightness/Contrast function:

  • Increasing the brightness moves the pivot point towards the upper left. This means that the image will appear lighter.
  • Decreasing the brightness moves the pivot point to the lower right. This means that the image will appear darker.

Contrast = 0.3, Brightness = 0, S-Curve Contrast Mode

Contrast = 0.3, Brightness = 0.3, S-Curve Contrast Mode

Sample Code#

// Set the Brightness parameter to 0.5
camera.BslBrightness.SetValue(0.5);
// Set the Contrast parameter to 1.2
camera.BslContrast.SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Brightness parameter to 0.5
CFloatParameter(nodemap, "BslBrightness").SetValue(0.5);
// Set the Contrast parameter to 1.2
CFloatParameter(nodemap, "BslContrast").SetValue(1.2);
// Set the Brightness parameter to 0.5
camera.Parameters[PLCamera.BslBrightness].SetValue(0.5);
// Set the Contrast parameter to 1.2
camera.Parameters[PLCamera.BslContrast].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 Brightness parameter to 0.5 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslBrightness", 0.5);
CHECK(errRes);
/* Set the Contrast parameter to 1.2 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslContrast", 1.2);
CHECK(errRes);
# Set the Brightness parameter to 0.5
camera.BslBrightness.Value = 0.5
# Set the Contrast parameter to 1.2
camera.BslContrast.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 Brightness parameter to 0.5 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslBrightness", 0.5);
CHECK(errRes);
/* Set the Contrast parameter to 1.2 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslContrast", 1.2);
CHECK(errRes);

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