Brightness and Contrast#
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:
- Set the
BslContrastMode
parameter to one of the following values (if available): - 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.
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.
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:
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.
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#
Camera Model | Available Contrast Modes |
---|---|
a2A640-240gmSWIR | Linear S-Curve |
a2A640-240umSWIR | Linear S-Curve |
a2A1280-80gmSWIR | Linear S-Curve |
a2A1280-125umSWIR | Linear S-Curve |
a2A1920-51gcBAS | Linear S-Curve |
a2A1920-51gcPRO | Linear S-Curve |
a2A1920-51gmBAS | Linear S-Curve |
a2A1920-51gmPRO | Linear S-Curve |
a2A1920-160ucBAS | Linear S-Curve |
a2A1920-160ucPRO | Linear S-Curve |
a2A1920-160umBAS | Linear S-Curve |
a2A1920-160umPRO | Linear S-Curve |
a2A1920-165g5cBAS | Linear S-Curve |
a2A1920-165g5mBAS | Linear S-Curve |
a2A2048-35gmSWIR | Linear S-Curve |
a2A2048-110umSWIR | Linear S-Curve |
a2A2440-98g5cBAS | Linear S-Curve |
a2A2440-98g5mBAS | Linear S-Curve |
a2A2448-23gcBAS | Linear S-Curve |
a2A2448-23gcPRO | Linear S-Curve |
a2A2448-23gmBAS | Linear S-Curve |
a2A2448-23gmPRO | Linear S-Curve |
a2A2448-75ucBAS | Linear S-Curve |
a2A2448-75ucPRO | Linear S-Curve |
a2A2448-75umBAS | Linear S-Curve |
a2A2448-75umPRO | Linear S-Curve |
a2A2448-105g5cBAS | Linear S-Curve |
a2A2448-105g5mBAS | Linear S-Curve |
a2A2448-120cc | Linear S-Curve |
a2A2448-120cm | Linear S-Curve |
a2A2448-210cc | Linear S-Curve |
a2A2448-210cm | Linear S-Curve |
a2A2560-20gmSWIR | Linear S-Curve |
a2A2560-70umSWIR | Linear S-Curve |
a2A2590-22gcBAS | Linear S-Curve |
a2A2590-22gcPRO | Linear S-Curve |
a2A2590-22gmBAS | Linear S-Curve |
a2A2590-22gmPRO | Linear S-Curve |
a2A2590-60ucBAS | Linear S-Curve |
a2A2590-60ucPRO | Linear S-Curve |
a2A2590-60umBAS | Linear S-Curve |
a2A2590-60umPRO | Linear S-Curve |
a2A2600-20gcBAS | Linear S-Curve |
a2A2600-20gcPRO | Linear S-Curve |
a2A2600-20gmBAS | Linear S-Curve |
a2A2600-20gmPRO | Linear S-Curve |
a2A2600-64ucBAS | Linear S-Curve |
a2A2600-64ucPRO | Linear S-Curve |
a2A2600-64umBAS | Linear S-Curve |
a2A2600-64umPRO | Linear S-Curve |
a2A2840-14gcBAS | Linear S-Curve |
a2A2840-14gcPRO | Linear S-Curve |
a2A2840-14gmBAS | Linear S-Curve |
a2A2840-14gmPRO | Linear S-Curve |
a2A2840-14gmUV | Linear S-Curve |
a2A2840-48ucBAS | Linear S-Curve |
a2A2840-48ucPRO | Linear S-Curve |
a2A2840-48umBAS | Linear S-Curve |
a2A2840-48umPRO | Linear S-Curve |
a2A2840-48umUV | Linear S-Curve |
a2A2840-67g5cBAS | Linear S-Curve |
a2A2840-67g5mBAS | Linear S-Curve |
a2A2840-67g5mUV | Linear S-Curve |
a2A2840-86cc | Linear S-Curve |
a2A2840-86cm | Linear S-Curve |
a2A3536-9gcBAS | Linear S-Curve |
a2A3536-9gcPRO | Linear S-Curve |
a2A3536-9gmBAS | Linear S-Curve |
a2A3536-9gmPRO | Linear S-Curve |
a2A3536-31ucBAS | Linear S-Curve |
a2A3536-31ucPRO | Linear S-Curve |
a2A3536-31umBAS | Linear S-Curve |
a2A3536-31umPRO | Linear S-Curve |
a2A3536-42g5cBAS | Linear S-Curve |
a2A3536-42g5mBAS | Linear S-Curve |
a2A3840-13gcBAS | Linear S-Curve |
a2A3840-13gcPRO | Linear S-Curve |
a2A3840-13gmBAS | Linear S-Curve |
a2A3840-13gmPRO | Linear S-Curve |
a2A3840-45ucBAS | Linear S-Curve |
a2A3840-45ucPRO | Linear S-Curve |
a2A3840-45umBAS | Linear S-Curve |
a2A3840-45umPRO | Linear S-Curve |
a2A4096-9gcBAS | Linear S-Curve |
a2A4096-9gcPRO | Linear S-Curve |
a2A4096-9gmBAS | Linear S-Curve |
a2A4096-9gmPRO | Linear S-Curve |
a2A4096-30ucBAS | Linear S-Curve |
a2A4096-30ucPRO | Linear S-Curve |
a2A4096-30umBAS | Linear S-Curve |
a2A4096-30umPRO | Linear S-Curve |
a2A4096-44g5cBAS | Linear S-Curve |
a2A4096-44g5mBAS | Linear S-Curve |
a2A4096-67cc | Linear S-Curve |
a2A4096-67cm | Linear S-Curve |
a2A4200-12gcBAS | Linear S-Curve |
a2A4200-12gcPRO | Linear S-Curve |
a2A4200-12gmBAS | Linear S-Curve |
a2A4200-12gmPRO | Linear S-Curve |
a2A4200-40ucBAS | Linear S-Curve |
a2A4200-40ucPRO | Linear S-Curve |
a2A4200-40umBAS | Linear S-Curve |
a2A4200-40umPRO | Linear S-Curve |
a2A4504-5gcBAS | Linear S-Curve |
a2A4504-5gcPRO | Linear S-Curve |
a2A4504-5gmBAS | Linear S-Curve |
a2A4504-5gmPRO | Linear S-Curve |
a2A4504-18ucBAS | Linear S-Curve |
a2A4504-18ucPRO | Linear S-Curve |
a2A4504-18umBAS | Linear S-Curve |
a2A4504-18umPRO | Linear S-Curve |
a2A4504-27g5cBAS | Linear S-Curve |
a2A4504-27g5mBAS | Linear S-Curve |
a2A4504-42cc | Linear S-Curve |
a2A4504-42cm | Linear S-Curve |
a2A4508-6gcBAS | Linear S-Curve |
a2A4508-6gcPRO | Linear S-Curve |
a2A4508-6gmBAS | Linear S-Curve |
a2A4508-6gmPRO | Linear S-Curve |
a2A4508-20ucBAS | Linear S-Curve |
a2A4508-20ucPRO | Linear S-Curve |
a2A4508-20umBAS | Linear S-Curve |
a2A4508-20umPRO | Linear S-Curve |
a2A5060-4gcBAS | Linear S-Curve |
a2A5060-4gmBAS | Linear S-Curve |
a2A5060-15ucBAS | Linear S-Curve |
a2A5060-15umBAS | Linear S-Curve |
a2A5060-21g5cBAS | Linear S-Curve |
a2A5060-21g5mBAS | Linear S-Curve |
a2A5320-7gcBAS | Linear S-Curve |
a2A5320-7gcPRO | Linear S-Curve |
a2A5320-7gmBAS | Linear S-Curve |
a2A5320-7gmPRO | Linear S-Curve |
a2A5320-23ucBAS | Linear S-Curve |
a2A5320-23ucPRO | Linear S-Curve |
a2A5320-23umBAS | Linear S-Curve |
a2A5320-23umPRO | Linear S-Curve |
a2A5320-34g5cBAS | Linear S-Curve |
a2A5320-34g5mBAS | Linear S-Curve |
a2A5320-52cc | Linear S-Curve |
a2A5320-52cm | Linear S-Curve |
a2A5328-4gcBAS | Linear S-Curve |
a2A5328-4gcPRO | Linear S-Curve |
a2A5328-4gmBAS | Linear S-Curve |
a2A5328-4gmPRO | Linear S-Curve |
a2A5328-15ucBAS | Linear S-Curve |
a2A5328-15ucPRO | Linear S-Curve |
a2A5328-15umBAS | Linear S-Curve |
a2A5328-15umPRO | Linear S-Curve |
a2A5328-22g5cBAS | Linear S-Curve |
a2A5328-22g5mBAS | Linear S-Curve |
a2A5328-35cc | Linear S-Curve |
a2A5328-35cm | Linear S-Curve |
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 |
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-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-20uc | 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-165uc | Brightness and Contrast feature not supported |
acA2000-165um | 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-57ucMED | Linear S-Curve |
acA3088-57um | Brightness and Contrast feature not supported |
acA3088-57umMED | Linear S-Curve |
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 |
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 |
acA5472-17umMED | Linear S-Curve |
boA1936-400cc | Linear S-Curve |
boA1936-400cm | Linear S-Curve |
boA2448-250cc | Linear S-Curve |
boA2448-250cm | Linear S-Curve |
boA2832-190cc | Linear S-Curve |
boA2832-190cm | Linear S-Curve |
boA4096-93cc | Linear S-Curve |
boA4096-93cm | Linear S-Curve |
boA4096-180cc | Linear S-Curve |
boA4096-180cm | Linear S-Curve |
boA4112-68cc | Linear S-Curve |
boA4112-68cm | Linear S-Curve |
boA4500-45cc | Linear S-Curve |
boA4500-45cm | Linear S-Curve |
boA4504-100cc | Linear S-Curve |
boA4504-100cm | Linear S-Curve |
boA5120-150cc | Brightness and Contrast feature not supported |
boA5120-150cm | Brightness and Contrast feature not supported |
boA5120-230cc | Brightness and Contrast feature not supported |
boA5120-230cm | Brightness and Contrast feature not supported |
boA5320-150cc | Linear S-Curve |
boA5320-150cm | Linear S-Curve |
boA5328-100cc | Linear S-Curve |
boA5328-100cm | Linear S-Curve |
boA6500-36cc | Linear S-Curve |
boA6500-36cm | Linear S-Curve |
boA8100-16cc | Linear S-Curve |
boA8100-16cm | Linear S-Curve |
boA9344-30cc | Brightness and Contrast feature not supported |
boA9344-30cm | Brightness and Contrast feature not supported |
boA9344-70cc | Brightness and Contrast feature not supported |
boA9344-70cm | Brightness and Contrast feature not supported |
boA13440-17cm | Brightness and Contrast feature not supported |
daA720-520uc | Linear S-Curve |
daA720-520um | Linear S-Curve |
daA1280-54uc | Linear S-Curve |
daA1280-54um | Linear S-Curve |
daA1440-220uc | Linear S-Curve |
daA1440-220um | 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 |
daA1920-160uc | Linear S-Curve |
daA1920-160um | Linear S-Curve |
daA2448-70uc | Linear S-Curve |
daA2448-70um | Linear S-Curve |
daA2500-14uc | Linear S-Curve |
daA2500-14um | Linear S-Curve |
daA3840-45uc | Linear S-Curve |
daA3840-45um | Linear S-Curve |
dmA720-290gc | Linear S-Curve |
dmA720-290gm | Linear S-Curve |
dmA1440-73gc | Linear S-Curve |
dmA1440-73gm | Linear S-Curve |
dmA1920-51gc | Linear S-Curve |
dmA1920-51gm | Linear S-Curve |
dmA3536-9gc | Linear S-Curve |
dmA3536-9gm | Linear 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 |
r2L2048-29gc | Linear S-Curve |
r2L2048-58gm | Linear S-Curve |
r2L2048-62cc | Linear S-Curve |
r2L2048-62g5c | Linear S-Curve |
r2L2048-172cm | Linear S-Curve |
r2L2048-172g5m | Linear S-Curve |
r2L4096-14gc | Linear S-Curve |
r2L4096-29gm | Linear S-Curve |
r2L4096-42cc | Linear S-Curve |
r2L4096-42g5c | Linear S-Curve |
r2L4096-84cm | Linear S-Curve |
r2L4096-84g5m | Linear S-Curve |
r2L8192-200cm | Linear S-Curve |
r2L16384-120cm | Linear S-Curve |
Sample Code#
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);
/* 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.