跳转到内容
STAGING SERVER
DEVELOPMENT SERVER

Gamma (dart E)#

相机的 Gamma 功能使您可以优化所采集图像的亮度,以便在显示器上显示。

该功能的使用#

运作原理#

相机根据以下公式(以彩色相机和红色像素值 (R) 为例)将 Gamma 校正值 (γ) 应用于每个像素的亮度值:

Gamma 校正公式(红色像素)

具体的最大像素值 (Rmax) 视情况而有所不同,例如在 8 位像素格式下为 255,在 10 位像素格式下为 1023。

配置 Gamma 校正#

若要配置 Gamma 校正,请将 Gamma 参数设置为所需的值。该参数的值范围为 0 到 ≈4。- Gamma = 1:整体亮度保持 不变。- Gamma < 1:整体亮度 增加。- Gamma > 1:整体亮度 降低.

在所有情况下,黑色像素(亮度 = 0)和白色像素(亮度 = 最大值)都不会被调整。

信息

如果启用 Gamma 校正,并且像素格式设置为 12 位像素格式,则会丢失一些图像信息。像素数据输出仍将是 12 位,但是像素值将在 Gamma 校正过程中插入。

设置色彩空间#

在 daA…mci 相机模块上, BslColorSpace 参数可用。它允许您选择以下 Gamma 校正模式之一:

  • RGB:不应用额外的 Gamma 校正值。
  • sRGB:图像亮度针对在 sRGB 显示器上的显示进行了优化。应用了大约 0.4 的 Gamma 校正值, Gamma 参数将变为只读,并且 Gamma 参数值将被忽略。

示例代码#

// Set the Gamma value to 1.2
camera.Gamma.SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Gamma value to 1.2
CFloatParameter(nodemap, "Gamma").SetValue(1.2);
// Set the Gamma value to 1.2
camera.Parameters[PLCamera.Gamma].SetValue(1.2);
/* 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 Gamma value to 1.2 */
errRes = PylonDeviceSetFloatFeature(hdev, "Gamma", 1.2);
CHECK(errRes);
# Set the Gamma value to 1.2
camera.Gamma.Value = 1.2
/* 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 Gamma value to 1.2 */
errRes = PylonDeviceSetFloatFeature(hdev, "Gamma", 1.2);
CHECK(errRes);

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