Defect Pixel Correction#

The Defect Pixel Correction camera feature minimizes the influence of single pixels that appear too bright or too dark.

Using the Feature#

How It Works#

In acquired images, some pixels may appear significantly brighter or darker than the rest, even if uniform light is used. This problem is caused by differences in sensitivity of the individual pixels which in turn are due to production tolerances.

The Defect Pixel Correction feature minimizes the influence of these sensitivity differences. The camera identifies pixels that have a significantly higher or lower intensity value than their neighboring pixels ("outlier pixels") and adjusts their intensity value.

Basler cameras can perform two types of pixel corrections:

  • The static pixel correction corrects pixels that have a significantly lesser intensity value than its neighboring pixels, including completely black pixels.
  • The dynamic pixel correction corrects pixels that have a significantly greater intensity value than its neighboring pixels, including completely white pixels.

Enabling Defect Pixel Correction#

To configure the Defect Pixel Correction feature, set the DefectPixelCorrectionMode parameter to one of the following values:

  • On (default): The camera performs static and dynamic pixel corrections.
  • StaticOnly: The camera performs the static pixel correction only.
  • Off: The camera does not perform pixel corrections.

Sample Code#

// Disable defect pixel correction
camera.DefectPixelCorrectionMode.SetValue(DefectPixelCorrectionMode_Off);
INodeMap& nodemap = camera.GetNodeMap();
// Disable defect pixel correction
CEnumerationPtr(nodemap.GetNode("DefectPixelCorrectionMode"))->FromString("Off");
INodeMap& nodemap = camera.GetNodeMap();
// Disable defect pixel correction
CEnumParameter(nodemap, "DefectPixelCorrectionMode").SetValue("Off");
// Disable defect pixel correction
camera.Parameters[PLCamera.DefectPixelCorrectionMode].SetValue(PLCamera.DefectPixelCorrectionMode.Off);
// Disable defect pixel correction
Pylon.DeviceFeatureFromString(hdev, "DefectPixelCorrectionMode", "Off");
/* 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 defect pixel correction */
errRes = PylonDeviceFeatureFromString(hdev, "DefectPixelCorrectionMode", "Off");
CHECK(errRes);

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