跳转到内容

Pattern Removal Auto#

相机的 Pattern Removal Auto 功能可抑制单色图像上形成的棋盘格图案。

该功能的使用#

为什么使用 Pattern Removal Auto#

部分相机输出的图像可能会显示出类似叠加棋盘格图案的伪影。这种现象源自特定的传感器设计。仅当入射光垂直于传感器表面时,传感器阵列中的任何 2 x 2 像素才会对光线产生相同的响应。如果光线以倾斜角度射入,它们的响应会略有不同。这会导致图像中出现棋盘格图案。

您可以通过确保将适当的校正系数应用于原始像素值来抑制棋盘格图案的出现。校正系数会在每次图像采集时自动应用。

Pattern Removal Auto 使您可以确保校正系数的值适合于每次图像采集。该值仅在使用了 Pattern Removal Auto 时出现特定成像条件的情况下生效。

特征#

自动功能 Pattern Removal Auto 在某些方面与其他自动功能有所不同:

  • 您不必指定自动功能 ROI
  • 您不必指定目标值。自动功能会生成校正系数值,该校正系数值将尽可能消除棋盘格图案。
  • Only the Once operating mode is available.

启用和使用 Pattern Removal Auto#

使用自动功能 Pattern Removal Auto:

  1. 图像 ROI 设置为其最大尺寸。
  2. 如果可能,营造出均匀照明。
  3. 禁用所有可能影响校正值生成的功能,例如 Gain AutoExposure AutoSequencer
  4. Adjust the camera settings (e.g., Exposure Time, Black Level, and Digital Shift) as desired. For best results, the gray values should be homogeneous across the image.
  5. Set the PatternRemovalAuto parameter to Once.
  6. Acquire three images. Make sure that the target scene doesn't change between acquisitions.
    The camera generates and applies optimum correction values for the current imaging conditions. This occurs instantaneously and has no effect on the camera's frame rate. After the third acquisition, the PatternRemovalAuto parameter is automatically set to Off.
  7. 如有必要,恢复图像 ROI 的原始大小。

生成的校正值将一直应用到发生以下任一事件为止:

  • PatternRemovalAuto is set to Once.
  • 相机已与电源断开(为避免丢失校正值,请保存校正值)。
  • 加载了具有不同校正值的用户设置集

重复执行 Pattern Removal Auto 流程#

当相关的成像条件发生变化时,应重复执行 Pattern Removal Auto 流程。这能确保在条件改变的情况下仍能可靠地去除棋盘格图案,并且确保了像素值不会发生不必要的更改。

相关的成像条件如下:

保存校正值#

如果相机断开电源,则自动功能 Pattern Removal Auto 生成的校正值将会丢失

但是,您可以将校正值保存在用户设置集中。每当您想再次使用校正值时,都可以加载此用户设置集。

加载校正值时,请确保成像条件与生成校正值时的条件相同。

示例代码#

// Set the operating mode of the Pattern Removal Auto auto function to Once
camera.PatternRemovalAuto.SetValue(PatternRemovalAuto_Once);
// Acquire three images
// ...
// (Implement your own image grabbing routine here.
// For example, the InstantCamera class provides the StartGrabbing() method.)
// ...
// Save the correction values in User Set 1
camera.UserSetSelector.SetValue(UserSetSelector_UserSet1);
camera.UserSetSave.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Set the operating mode of the Pattern Removal Auto auto function to Once
CEnumParameter(nodemap, "PatternRemovalAuto").SetValue("Once");
// Acquire three images
// ...
// (Implement your own image grabbing routine here.
// For example, the InstantCamera class provides the StartGrabbing() method.)
// ...
// Save the correction values in User Set 1
CEnumParameter(nodemap, "UserSetSelector").SetValue("UserSet1");
CCommandParameter(nodemap, "UserSetSave").Execute();
// Set the operating mode of the Pattern Removal Auto auto function to Once
camera.Parameters[PLCamera.PatternRemovalAuto].SetValue(PLCamera.PatternRemovalAuto.Once);
// Acquire three images
// ...
// (Implement your own image grabbing routine here.
// For example, the InstantCamera class provides the StartGrabbing() method.)
// ...
// Save the correction values in User Set 1
camera.Parameters[PLCamera.UserSetSelector].SetValue(PLCamera.UserSetSelector.UserSet1);
camera.Parameters[PLCamera.UserSetSave].Execute();
/* 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 operating mode of the Pattern Removal Auto auto function to Once */
errRes = PylonDeviceFeatureFromString(hdev, "PatternRemovalAuto", "Once");
CHECK(errRes);
/* Acquire three images */
/* ... */
/* (Implement your own image grabbing routine here. */
/* For example, the InstantCamera class provides the StartGrabbing() method.) */
/* ... */
/* Save the correction values in User Set 1 */
errRes = PylonDeviceFeatureFromString(hdev, "UserSetSelector", "UserSet1");
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "UserSetSave");
CHECK(errRes);
# Set the operating mode of the Pattern Removal Auto auto function to Once
camera.PatternRemovalAuto.Value = "Once"
# Acquire three images
# ...
# (Implement your own image grabbing routine here.
# For example, the InstantCamera class provides the StartGrabbing() method.)
# ...
# Save the correction values in User Set 1
camera.UserSetSelector.Value = "UserSet1"
camera.UserSetSave.Execute()

您也可以使用 pylon Viewer 轻松设置参数。