跳转到内容
STAGING SERVER
DEVELOPMENT SERVER

Demosaicing Mode#

通过 Demosaicing Mode 相机功能,您可以更改用于 demosaicing 的方法。

这有助于优化图像质量。

信息

此功能适用于 Basler ace 2、boost R 和 dart R 相机。

Basler ace U/L 相机还提供了一个 DemosaicingMode 参数,但该参数仅用于启用 PGI Feature Set.

该功能的使用#

为什么使用 Demosaicing Mode#

Demosaicing(也称为去马赛克)用于从图像传感器的彩色输出生成 RGB 信息。

Basler 彩色相机始终执行 demosaicing,即使像素格式设置为 Bayer 格式也是如此。这是由相机的内部图像处理决定的。

您的相机提供了用于 demosaicing 的不同方法。默认情况下,该方法会根据设置的像素格式自动确定。

如果自动选择的方法产生的结果无法满足您的应用要求,手动调整 Demosaicing Mode 会有所帮助。

例如,相机针对 Bayer 像素格式自动选择 Nearest Neighbor 方法。这样做是为了确保与旧版本固件的兼容性。然而,Unilinear 方法通常能取得更好的效果。

Demosaicing 方法#

提供以下 demosaicing 方法:

Demosaicing Method 描述 适用于非 Bayer 像素格式 适用于 Bayer 像素格式
Average Green 使用来自最接近像素之一的信息或周围绿色像素的 arithmetic 平均值。如果 Basler PGI 不可用,这是非 Bayer 像素格式的默认方法。
Basler PGI 如果可用,则使用 Basler PGI 算法进行高级 demosaicing。
Nearest Neighbor 使用来自最接近像素之一的信息。这是 Bayer 像素格式的默认方法,并可提供与先前固件版本的最佳兼容性。
Unilinear 使用来自最接近像素之一的信息或周围像素的 arithmetic 平均值。与 Nearest Neighbor demosaicing 相比,边缘处产生的彩色伪影更少。

Demosaicing Modes#

提供以下 demosaicing 模式:

  • Auto: 根据设置的像素格式自动确定 demosaicing 方法。
  • Manual:可以手动设置 demosaicing 方法。

配置 Demosaicing#

要更改用于去马赛克的算法:

  1. 设置 BslDemosaicingMode 参数至 Manual.
  2. 设置 BslDemosaicingMethod 将参数设置为所需的 去马赛克算法,例如 Unilinear.

示例代码#

// Enable manual adjustment of the demosaicing method
camera.BslDemosaicingMode.SetValue(BslDemosaicingMode_Manual);
// Set the demosaicing method to Unilinear
camera.BslDemosaicingMethod.SetValue(BslDemosaicingMethod_Unilinear);
INodeMap& nodemap = camera.GetNodeMap();
// Enable manual adjustment of the demosaicing method
CEnumParameter(nodemap, "BslDemosaicingMode").SetValue("Manual");
// Set the demosaicing method to Unilinear
CEnumParameter(nodemap, "BslDemosaicingMethod").SetValue("Unilinear");
// Enable manual adjustment of the demosaicing method
camera.Parameters[PLCamera.BslDemosaicingMode].SetValue(PLCamera.BslDemosaicingMode.Manual);
// Set the demosaicing method to Unilinear
camera.Parameters[PLCamera.BslDemosaicingMethod].SetValue(PLCamera.BslDemosaicingMethod.Unilinear);
/* 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 */
/* Enable manual adjustment of the demosaicing method */
errRes = PylonDeviceFeatureFromString(hdev, "BslDemosaicingMode", "Manual");
CHECK(errRes);
/* Set the demosaicing method to Unilinear */
errRes = PylonDeviceFeatureFromString(hdev, "BslDemosaicingMethod", "Unilinear");
CHECK(errRes);
# Enable manual adjustment of the demosaicing method
camera.BslDemosaicingMode.Value = "Manual"
# Set the demosaicing method to Unilinear
camera.BslDemosaicingMethod.Value = "Unilinear"

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