Vignetting Correction#

The Vignetting Correction camera feature allows you to remove vignetting artifacts from your images.

This feature works in conjunction with the Vignetting Correction feature in the pylon Viewer.

Info

  • This feature will be rolled out over the course of 2019. For availability information, please refer to the corresponding Product Change Notification.
  • On ace 2 and boost cameras, all parameter names of this feature are prefixed with Bsl. Example: BslVignettingCorrectionMode.

Using the Feature#

Vignetting means a darkening of the corners of an image compared to its center. It is a common effect in digital imaging and occurs when the pixels at the edges of the sensor don't receive sufficient light. This can happen, e.g., because the image circle is too small in relation to the size of the sensor or because the light rays don't hit the sensor at right angles like they do at the center of the sensor. This means that the pixels at the edges have lower gray values.

To remove these artifacts, you have to create a set of correction data using the pylon Viewer. The following diagram illustrates this process:

Vignetting Correction Process Diagram

In step 1, correction values (CV) for all pixels are calculated and saved in the camera's memory. In step 2, the vignetting artifacts are removed immediately if the VignettingCorrectionMode parameter is enabled. To remove the artifacts, the correction values are multiplied with the original pixel values (OV) to achieve an improved image (Resulting Values, RV).

Using the VignettingCorrectionMode parameter, you can turn the correction on and off. This parameter will only be available after you have created vignetting correction data using the pylon Viewer.

You can also use vignetting correction data from a different camera if your camera has similar specifications as the one on which you created the vignetting correction data. To do so, follow these steps. Afterwards, execute the VignettingCorrectionLoad command.

Info

For best results, disable all non-linear features, e.g., light source presets or gamma, before creating the correction data. Afterwards, you can enable them again.

Sample Code#

// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Example: BslVignettingCorrectionMode
// Turn vignetting correction on
camera.VignettingCorrectionMode.SetValue(VignettingCorrectionMode_On);
// Load vignetting correction data
camera.VignettingCorrectionLoad.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Example: BslVignettingCorrectionMode
// Turn vignetting correction on
CEnumerationPtr(nodemap.GetNode("VignettingCorrectionMode"))->FromString("On");
// Load vignetting correction data
CCommandPtr(nodemap.GetNode("VignettingCorrectionLoad"))->Execute();
INodeMap& nodemap = camera.GetNodeMap();
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Example: BslVignettingCorrectionMode
// Turn vignetting correction on
CEnumParameter(nodemap, "VignettingCorrectionMode").SetValue("On");
// Load vignetting correction data
CCommandParameter(nodemap, "VignettingCorrectionLoad").Execute();
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Example: BslVignettingCorrectionMode
// Turn vignetting correction on
camera.Parameters[PLCamera.VignettingCorrectionMode].SetValue(PLCamera.VignettingCorrectionMode.On);
// Load vignetting correction data
camera.Parameters[PLCamera.VignettingCorrectionLoad].Execute();
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Example: BslVignettingCorrectionMode
// Turn vignetting correction on
Pylon.DeviceFeatureFromString(hdev, "VignettingCorrectionMode", "On");
// Load vignetting correction data
Pylon.DeviceExecuteCommandFeature(hdev, "VignettingCorrectionLoad");
/* 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 */
/* NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl. */
/* Example: BslVignettingCorrectionMode */
/* Turn vignetting correction on */
errRes = PylonDeviceFeatureFromString(hdev, "VignettingCorrectionMode", "On");
CHECK(errRes);
/* Load vignetting correction data */
errRes = PylonDeviceExecuteCommandFeature(hdev, "VignettingCorrectionLoad");
CHECK(errRes);

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