Skip to content

Digital Shift#

The Digital Shift camera feature allows you to multiply the pixel values of the images.

This increases the brightness of the image. If your camera doesn't support the digital shift feature, you can use the Gain feature to achieve a similar effect.

Using the Feature#

How It Works#

Configuring a digital shift factor of n results in a logical left shift by n on all pixel values. This has the effect of multiplying all pixel values by 2n.

If the resulting pixel value is greater than the maximum value possible for the current pixel format (e.g., 4 095 for a 12-bit pixel format), the value is set to the maximum value.

For more information, see the examples below.

Configuring Digital Shift#

To configure the digital shift factor, enter the desired value for the DigitalShift parameter.

By default, the parameter is set to 0, i.e., digital shift is disabled.

Examples#

Example 1: Digital Shift by 1, 12-Bit Image Data#

Assume that you have entered a digital shift factor of 1 on a camera that uses a 12-bit pixel format. This has the following effects:

Digital Shift by 1, 12-Bit Image Data Output

  • The least significant bit in each 12-bit image data word is set to 0.
  • The pixel values are multiplied by 21= 2.
  • Because the least significant bit is set to 0, the camera transmits only even pixel values, e.g., 2, 4, 6, 8, 10, and so on.

Example 2: Digital Shift by 2, 12-Bit Image Data#

Assume that you have entered a digital shift factor of 2 on a camera that uses a 12-bit pixel format. This has the following effects:

Digital Shift by 2, 12-Bit Image Data Output

  • The least 2 significant bits in each 12-bit image data word are set to 0.
  • The pixel values are multiplied by 22= 4.
  • Because the two least significant bits are set to 0, the camera transmits only every fourth pixel value, e.g., 4, 8, 12, 16, 20, and so on.

Example 3: Digital Shift by 2, 8-Bit Image Data#

Assume that your camera has a maximum pixel bit depth of 12 bit, but is currently using an 8-bit pixel format.

In this case, the camera first performs the digital shift calculation on the 12-bit image data. Then, the camera drops the 4 least significant bits and transmits the 8 most significant bits:

Digital Shift by 2, 8-Bit Image Data Output

Info

On the following camera models, if an 8-bit pixel format is set, digital shift will be performed on 10-bit image data, regardless of the maximum pixel bit depth: acA720-290gm/gc, acA1440-73gm/gc, acA1920-40gm/gc, acA1920-50gm/gc, acA1440-220um/uc, acA1920-40um/uc, acA1920-155um/uc, acA2040-120um/uc, acA2440-75um/uc, acA4096-40um/uc, acA4112-30um/uc.

Example 4: Digital Shift by 1, 12-bit Image Data, High Value#

Assume that your camera is using a 12-bit pixel format. Also assume that one of your original pixel values is 2 839:

Digital Shift by 1, 12-bit Image Data Output, Value of 2839

If you apply digital shift by 1 to this pixel value, the resulting value is greater than the maximum possible value for 12-bit pixel formats (4096 + 1024 + 512 + 32 + 8 + 4 + 2 = 5678; maximum value for 12-bit formats: 4 095). In this case, the value is set to the maximum value, i.e., all bits are set to 1:

Digital Shift by 1, 12-bit Image Data Output, Resulting Value 4095

Info

As a consequence, make sure not to apply a digital shift factor that is too high for your imaging scenario. Otherwise, all bright areas in your images will be set to white, i.e., image information will be lost.

Sample Code#

// Disable digital shift
camera.DigitalShift.SetValue(0);
// Enable digital shift by 2
camera.DigitalShift.SetValue(2);
INodeMap& nodemap = camera.GetNodeMap();
// Disable digital shift
CIntegerParameter(nodemap, "DigitalShift").SetValue(0);
// Enable digital shift by 2
CIntegerParameter(nodemap, "DigitalShift").SetValue(2);
// Disable digital shift
camera.Parameters[PLCamera.DigitalShift].SetValue(0);
// Enable digital shift by 2
camera.Parameters[PLCamera.DigitalShift].SetValue(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 */
/* Disable digital shift */
errRes = PylonDeviceSetIntegerFeature(hdev, "DigitalShift", 0);
CHECK(errRes);
/* Enable digital shift by 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "DigitalShift", 2);
CHECK(errRes);
# Disable digital shift
camera.DigitalShift.Value = 0
# Enable digital shift by 2
camera.DigitalShift.Value = 2

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