Skip to content

Brightness and Contrast#

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 and Contrast Mode#

To adjust the contrast:

  1. Set the BslContrastMode parameter to one of the following values (if available):
  2. 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 and Contrast Modes#

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.

How the contrast is applied depends on the contrast mode that you select.

Linear Contrast Mode

If this contrast mode is selected, the camera uses a linear function to adjust the contrast. Increasing or decreasing the contrast, increases or decreases the gradient of the linear function.

Contrast = 0, Brightness = 0, Linear Contrast Mode

Contrast = 0.3, Brightness = 0, Linear Contrast Mode

With a contrast setting greater than 0, more output pixel values will be set to completely black (0) or completely white (maximum pixel value).

If the contrast is set to 0.3 (see second figure), input values from 0 to approximately 50 are set to completely black, and input values from approximately 205 to 255 are set to completely white. This means that the overall range of tonal values, i.e, the dynamic range of the image, is reduced. The darkest and lightest regions of the image will appear completely black or completely white, but the other areas will appear more defined.

Decreasing the contrast has the opposite effect.

S-Curve Contrast Mode

If this contrast mode is selected, 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.

The figures below show examples with the S-Curve contrast mode selected.

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

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

Additional Parameters#

If available, the BslBrightnessRaw and BslContrastRaw parameters allow you to enter integer values instead of float values for the brightness and contrast parameters. Normally, you don't need to set these parameters.

Specifics#

Show all camera models

Camera Model Available Contrast Modes
a2A1920-51gcBAS Brightness and Contrast feature not supported
a2A1920-51gcPRO Brightness and Contrast feature not supported
a2A1920-51gmBAS Brightness and Contrast feature not supported
a2A1920-51gmPRO Brightness and Contrast feature not supported
a2A1920-160ucBAS Brightness and Contrast feature not supported
a2A1920-160ucPRO Brightness and Contrast feature not supported
a2A1920-160umBAS Brightness and Contrast feature not supported
a2A1920-160umPRO Brightness and Contrast feature not supported
a2A2590-22gcBAS Brightness and Contrast feature not supported
a2A2590-22gcPRO Brightness and Contrast feature not supported
a2A2590-22gmBAS Brightness and Contrast feature not supported
a2A2590-22gmPRO Brightness and Contrast feature not supported
a2A2590-60ucBAS Brightness and Contrast feature not supported
a2A2590-60ucPRO Brightness and Contrast feature not supported
a2A2590-60umBAS Brightness and Contrast feature not supported
a2A2590-60umPRO Brightness and Contrast feature not supported
a2A3840-13gcBAS Brightness and Contrast feature not supported
a2A3840-13gcPRO Brightness and Contrast feature not supported
a2A3840-13gmBAS Brightness and Contrast feature not supported
a2A3840-13gmPRO Brightness and Contrast feature not supported
a2A3840-45ucBAS Brightness and Contrast feature not supported
a2A3840-45ucPRO Brightness and Contrast feature not supported
a2A3840-45umBAS Brightness and Contrast feature not supported
a2A3840-45umPRO Brightness and Contrast feature not supported
acA640-90gc Brightness and Contrast feature not supported
acA640-90gm Brightness and Contrast feature not supported
acA640-90uc Brightness and Contrast feature not supported
acA640-90um Brightness and Contrast feature not supported
acA640-120gc Brightness and Contrast feature not supported
acA640-120gm Brightness and Contrast feature not supported
acA640-120uc Brightness and Contrast feature not supported
acA640-120um Brightness and Contrast feature not supported
acA640-121gm Brightness and Contrast feature not supported
acA640-300gc Brightness and Contrast feature not supported
acA640-300gm Brightness and Contrast feature not supported
acA640-750uc Brightness and Contrast feature not supported
acA640-750um Brightness and Contrast feature not supported
acA720-290gc Brightness and Contrast feature not supported
acA720-290gm Brightness and Contrast feature not supported
acA720-520uc Brightness and Contrast feature not supported
acA720-520um Brightness and Contrast feature not supported
acA780-75gc Brightness and Contrast feature not supported
acA780-75gm Brightness and Contrast feature not supported
acA800-200gc Brightness and Contrast feature not supported
acA800-200gm Brightness and Contrast feature not supported
acA800-510uc Brightness and Contrast feature not supported
acA800-510um Brightness and Contrast feature not supported
acA1280-60gc Brightness and Contrast feature not supported
acA1280-60gm Brightness and Contrast feature not supported
acA1300-22gc Brightness and Contrast feature not supported
acA1300-22gm Brightness and Contrast feature not supported
acA1300-30gc Brightness and Contrast feature not supported
acA1300-30gm Brightness and Contrast feature not supported
acA1300-30uc Brightness and Contrast feature not supported
acA1300-30um Brightness and Contrast feature not supported
acA1300-60gc Brightness and Contrast feature not supported
acA1300-60gm Brightness and Contrast feature not supported
acA1300-60gmNIR Brightness and Contrast feature not supported
acA1300-75gc Brightness and Contrast feature not supported
acA1300-75gm Brightness and Contrast feature not supported
acA1300-200uc Brightness and Contrast feature not supported
acA1300-200um Brightness and Contrast feature not supported
acA1440-73gc Brightness and Contrast feature not supported
acA1440-73gm Brightness and Contrast feature not supported
acA1440-220uc Brightness and Contrast feature not supported
acA1440-220um Brightness and Contrast feature not supported
acA1600-20gc Brightness and Contrast feature not supported
acA1600-20gm Brightness and Contrast feature not supported
acA1600-20uc Brightness and Contrast feature not supported
acA1600-20um Brightness and Contrast feature not supported
acA1600-60gc Brightness and Contrast feature not supported
acA1600-60gm Brightness and Contrast feature not supported
acA1920-25gc Brightness and Contrast feature not supported
acA1920-25gm Brightness and Contrast feature not supported
acA1920-25uc Brightness and Contrast feature not supported
acA1920-25um Brightness and Contrast feature not supported
acA1920-40gc Brightness and Contrast feature not supported
acA1920-40gm Brightness and Contrast feature not supported
acA1920-40uc Brightness and Contrast feature not supported
acA1920-40ucMED Linear
S-Curve
acA1920-40um Brightness and Contrast feature not supported
acA1920-40umMED Linear
S-Curve
acA1920-48gc Brightness and Contrast feature not supported
acA1920-48gm Brightness and Contrast feature not supported
acA1920-50gc Brightness and Contrast feature not supported
acA1920-50gm Brightness and Contrast feature not supported
acA1920-150uc Brightness and Contrast feature not supported
acA1920-150um Brightness and Contrast feature not supported
acA1920-155uc Brightness and Contrast feature not supported
acA1920-155ucMED Linear
S-Curve
acA1920-155um Brightness and Contrast feature not supported
acA1920-155umMED Linear
S-Curve
acA2000-50gc Brightness and Contrast feature not supported
acA2000-50gm Brightness and Contrast feature not supported
acA2000-50gmNIR Brightness and Contrast feature not supported
acA2000-165uc Brightness and Contrast feature not supported
acA2000-165um Brightness and Contrast feature not supported
acA2000-165umNIR Brightness and Contrast feature not supported
acA2040-25gc Brightness and Contrast feature not supported
acA2040-25gm Brightness and Contrast feature not supported
acA2040-25gmNIR Brightness and Contrast feature not supported
acA2040-35gc Brightness and Contrast feature not supported
acA2040-35gm Brightness and Contrast feature not supported
acA2040-55uc Brightness and Contrast feature not supported
acA2040-55um Brightness and Contrast feature not supported
acA2040-90uc Brightness and Contrast feature not supported
acA2040-90um Brightness and Contrast feature not supported
acA2040-90umNIR Brightness and Contrast feature not supported
acA2040-120uc Brightness and Contrast feature not supported
acA2040-120um Brightness and Contrast feature not supported
acA2440-20gc Brightness and Contrast feature not supported
acA2440-20gm Brightness and Contrast feature not supported
acA2440-35uc Brightness and Contrast feature not supported
acA2440-35ucMED Linear
S-Curve
acA2440-35um Brightness and Contrast feature not supported
acA2440-35umMED Linear
S-Curve
acA2440-75uc Brightness and Contrast feature not supported
acA2440-75ucMED Linear
S-Curve
acA2440-75um Brightness and Contrast feature not supported
acA2440-75umMED Linear
S-Curve
acA2500-14gc Brightness and Contrast feature not supported
acA2500-14gm Brightness and Contrast feature not supported
acA2500-14uc Brightness and Contrast feature not supported
acA2500-14um Brightness and Contrast feature not supported
acA2500-20gc Brightness and Contrast feature not supported
acA2500-20gcMED Linear
S-Curve
acA2500-20gm Brightness and Contrast feature not supported
acA2500-20gmMED Linear
S-Curve
acA2500-60uc Brightness and Contrast feature not supported
acA2500-60um Brightness and Contrast feature not supported
acA3088-16gc Brightness and Contrast feature not supported
acA3088-16gm Brightness and Contrast feature not supported
acA3088-57uc Brightness and Contrast feature not supported
acA3088-57um Brightness and Contrast feature not supported
acA3800-10gc Brightness and Contrast feature not supported
acA3800-10gm Brightness and Contrast feature not supported
acA3800-14uc Brightness and Contrast feature not supported
acA3800-14um Brightness and Contrast feature not supported
acA4024-8gc Brightness and Contrast feature not supported
acA4024-8gm Brightness and Contrast feature not supported
acA4024-29uc Brightness and Contrast feature not supported
acA4024-29um Brightness and Contrast feature not supported
acA4096-11gc Brightness and Contrast feature not supported
acA4096-11gm Brightness and Contrast feature not supported
acA4096-30uc Brightness and Contrast feature not supported
acA4096-30ucMED Linear
S-Curve
acA4096-30um Brightness and Contrast feature not supported
acA4096-30umMED Linear
S-Curve
acA4096-40uc Brightness and Contrast feature not supported
acA4096-40ucMED Linear
S-Curve
acA4096-40um Brightness and Contrast feature not supported
acA4096-40umMED Linear
S-Curve
acA4112-8gc Brightness and Contrast feature not supported
acA4112-8gm Brightness and Contrast feature not supported
acA4112-20uc Brightness and Contrast feature not supported
acA4112-20ucMED Linear
S-Curve
acA4112-20um Brightness and Contrast feature not supported
acA4112-20umMED Linear
S-Curve
acA4112-30uc Brightness and Contrast feature not supported
acA4112-30ucMED Linear
S-Curve
acA4112-30um Brightness and Contrast feature not supported
acA4112-30umMED Linear
S-Curve
acA4600-7gc Brightness and Contrast feature not supported
acA4600-10uc Brightness and Contrast feature not supported
acA5472-5gc Brightness and Contrast feature not supported
acA5472-5gm Brightness and Contrast feature not supported
acA5472-17uc Brightness and Contrast feature not supported
acA5472-17ucMED Linear
S-Curve
acA5472-17um Brightness and Contrast feature not supported
boA4096-93cc Brightness and Contrast feature not supported
boA4096-93cm Brightness and Contrast feature not supported
boA4112-68cc Brightness and Contrast feature not supported
boA4112-68cm Brightness and Contrast feature not supported
daA1280-54lc Linear
S-Curve
daA1280-54lm Linear
S-Curve
daA1280-54uc Linear
S-Curve
daA1280-54um Linear
S-Curve
daA1600-60lc Linear
S-Curve
daA1600-60lm Linear
S-Curve
daA1600-60uc Linear
S-Curve
daA1600-60um Linear
S-Curve
daA1920-15um Linear
S-Curve
daA1920-30uc Linear
S-Curve
daA1920-30um Linear
S-Curve
daA2500-14lc Linear
S-Curve
daA2500-14lm Linear
S-Curve
daA2500-14uc Linear
S-Curve
daA2500-14um Linear
S-Curve
daA2500-60mc Brightness and Contrast feature not supported
daA2500-60mci S-Curve
daA4200-30mci S-Curve
puA1280-54uc Linear
S-Curve
puA1280-54um Linear
S-Curve
puA1600-60uc Linear
S-Curve
puA1600-60um Linear
S-Curve
puA1920-30uc Linear
S-Curve
puA1920-30um Linear
S-Curve
puA2500-14uc Linear
S-Curve
puA2500-14um Linear
S-Curve

Sample Code#

// Set the Brightness parameter to 0.5
camera.BslBrightness.SetValue(0.5);
// Set the contrast mode to Linear
camera.BslContrastMode.SetValue(BslContrastMode_Linear);
// Set the Contrast parameter to 1.2
camera.BslContrast.SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Brightness parameter to 0.5
CFloatPtr(nodemap.GetNode("BslBrightness"))->SetValue(0.5);
// Set the contrast mode to Linear
CEnumerationPtr(nodemap.GetNode("BslContrastMode"))->FromString("Linear");
// Set the Contrast parameter to 1.2
CFloatPtr(nodemap.GetNode("BslContrast"))->SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Brightness parameter to 0.5
CFloatParameter(nodemap, "BslBrightness").SetValue(0.5);
// Set the contrast mode to Linear
CEnumParameter(nodemap, "BslContrastMode").SetValue("Linear");
// 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 mode to Linear
camera.Parameters[PLCamera.BslContrastMode].SetValue(PLCamera.BslContrastMode.Linear);
// Set the Contrast parameter to 1.2
camera.Parameters[PLCamera.BslContrast].SetValue(1.2);
// Set the Brightness parameter to 0.5
Pylon.DeviceSetFloatFeature(hdev, "BslBrightness", 0.5);
// Set the contrast mode to Linear
Pylon.DeviceFeatureFromString(hdev, "BslContrastMode", "Linear");
// Set the Contrast parameter to 1.2
Pylon.DeviceSetFloatFeature(hdev, "BslContrast", 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 mode to Linear */
errRes = PylonDeviceFeatureFromString(hdev, "BslContrastMode", "Linear");
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.