跳转到内容
STAGING SERVER
DEVELOPMENT SERVER

Demosaicing Mode#

通过 Demosaicing Mode camera feature,您可以更改用于 demosaicing 的方法。

这有助于优化图像 Quality。

信息

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

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

该功能的使用#

为什么要使用 Demosaicing Mode#

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

Basler 彩色相机始终会执行 demosaicing,即使 Pixel Format 设置为 Bayer 格式也是如此。这是由于相机的内部图像处理所致。

您的相机提供了用于 demosaicing 的 不同方法。默认情况下,系统会根据所设置的 Pixel Format 自动确定该方法。

如果自动选择的方法无法满足您的应用需求,手动调整 demosaicing mode 会有所帮助。

例如,相机针对 Bayer Pixel Format 会自动选择 Nearest Neighbor 方法。这样做是为了确保与较旧的固件版本兼容。但是,Unilinear 方法通常能取得更好的效果。

Demosaicing Methods#

可用以下 demosaicing methods:

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

Demosaicing Modes#

可用的 Demosaicing Mode 如下:

  • Auto:根据设置的 Pixel Format 自动确定 Demosaicing Mode。
  • Manual:可以手动设置 Demosaicing Mode。

配置 Demosaicing#

若要更改所使用的 Demosaicing 方法:

  1. 设置 BslDemosaicingMode acquisition mode Manual.
  2. 设置 BslDemosaicingMethod 参数设置为所需的值 demosaicing 方法,例如 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 轻松设置参数。