跳转到内容

Gamma#

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

该功能的使用#

运作原理#

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

Gamma 校正公式(红色像素)

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

启用 Gamma 校正#

要启用 Gamma 校正:

  1. 设置 GammaEnable parameter to true (如果可用).
  2. For best results, set the BlackLevel parameter to 0.
  3. 设置 Gamma 将参数设置为所需值。该参数值的范围是 0 至 ≈4。
    • Gamma = 1:整体亮度保持不变
    • Gamma < 1: The overall brightness increases.
    • Gamma > 1:整体亮度降低

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

信息

  • 如果启用 Gamma 校正,并且像素格式设置为 12 位像素格式,则会丢失一些图像信息。像素数据输出仍将是 12 位,但是像素值将在 Gamma 校正过程中插入。
  • On boA13440-17cm cameras, gamma correction can only be enabled, if the pixel format is set to an 8-bit pixel format.

附加参数#

根据您的相机型号,可以使用以下附加参数:

  • GammaEnable: Enables or disables gamma correction.
  • GammaSelector:允许您选择以下 Gamma 校正模式:
    • User: The gamma correction value can be set as desired. (Default.)
    • sRGB: The camera automatically sets a gamma correction value of approximately 0.4. This value is optimized for image display on sRGB monitors.
  • BslColorSpaceModeBslColorSpace:允许您选择以下 Gamma 校正模式:
    • RGB: No additional gamma correction value is applied.
    • sRGB: The image brightness is optimized for display on an sRGB monitor. A gamma correction value of approximately 0.4 is applied. For more information, see the footnotes in the 详情 section.

详情#

显示所有相机型号

相机型号 附加参数
a2A640-240gmSWIR
a2A640-240umSWIR
a2A1280-80gmSWIR
a2A1280-125umSWIR
a2A1920-51gcBAS BslColorSpacec
a2A1920-51gcPRO BslColorSpacec
a2A1920-51gmBAS
a2A1920-51gmPRO
a2A1920-160ucBAS BslColorSpacec
a2A1920-160ucPRO BslColorSpacec
a2A1920-160umBAS
a2A1920-160umPRO
a2A1920-165g5cBAS BslColorSpacec
a2A1920-165g5mBAS
a2A2048-35gmSWIR
a2A2048-110umSWIR
a2A2440-98g5cBAS BslColorSpacec
a2A2440-98g5mBAS
a2A2448-23gcBAS BslColorSpacec
a2A2448-23gcPRO BslColorSpacec
a2A2448-23gmBAS
a2A2448-23gmPRO
a2A2448-75ucBAS BslColorSpacec
a2A2448-75ucPRO BslColorSpacec
a2A2448-75umBAS
a2A2448-75umPRO
a2A2448-105g5cBAS BslColorSpacec
a2A2448-105g5mBAS
a2A2448-120cc BslColorSpacec
a2A2448-120cm
a2A2448-210cc BslColorSpacec
a2A2448-210cm
a2A2560-20gmSWIR
a2A2560-70umSWIR
a2A2590-22gcBAS BslColorSpacec
a2A2590-22gcPRO BslColorSpacec
a2A2590-22gmBAS
a2A2590-22gmPRO
a2A2590-60ucBAS BslColorSpacec
a2A2590-60ucPRO BslColorSpacec
a2A2590-60umBAS
a2A2590-60umPRO
a2A2600-20gcBAS BslColorSpacec
a2A2600-20gcPRO BslColorSpacec
a2A2600-20gmBAS
a2A2600-20gmPRO
a2A2600-64ucBAS BslColorSpacec
a2A2600-64ucPRO BslColorSpacec
a2A2600-64umBAS
a2A2600-64umPRO
a2A2840-14gcBAS BslColorSpacec
a2A2840-14gcPRO BslColorSpacec
a2A2840-14gmBAS
a2A2840-14gmPRO
a2A2840-14gmUV
a2A2840-48ucBAS BslColorSpacec
a2A2840-48ucPRO BslColorSpacec
a2A2840-48umBAS
a2A2840-48umPRO
a2A2840-48umUV
a2A2840-67g5cBAS BslColorSpacec
a2A2840-67g5mBAS
a2A2840-67g5mUV
a2A2840-86cc BslColorSpacec
a2A2840-86cm
a2A3536-9gcBAS BslColorSpacec
a2A3536-9gcPRO BslColorSpacec
a2A3536-9gmBAS
a2A3536-9gmPRO
a2A3536-31ucBAS BslColorSpacec
a2A3536-31ucPRO BslColorSpacec
a2A3536-31umBAS
a2A3536-31umPRO
a2A3536-42g5cBAS BslColorSpacec
a2A3536-42g5mBAS
a2A3840-13gcBAS BslColorSpacec
a2A3840-13gcPRO BslColorSpacec
a2A3840-13gmBAS
a2A3840-13gmPRO
a2A3840-45ucBAS BslColorSpacec
a2A3840-45ucPRO BslColorSpacec
a2A3840-45umBAS
a2A3840-45umPRO
a2A4096-9gcBAS BslColorSpacec
a2A4096-9gcPRO BslColorSpacec
a2A4096-9gmBAS
a2A4096-9gmPRO
a2A4096-30ucBAS BslColorSpacec
a2A4096-30ucPRO BslColorSpacec
a2A4096-30umBAS
a2A4096-30umPRO
a2A4096-44g5cBAS BslColorSpacec
a2A4096-44g5mBAS
a2A4096-67cc BslColorSpacec
a2A4096-67cm
a2A4200-12gcBAS BslColorSpacec
a2A4200-12gcPRO BslColorSpacec
a2A4200-12gmBAS
a2A4200-12gmPRO
a2A4200-40ucBAS BslColorSpacec
a2A4200-40ucPRO BslColorSpacec
a2A4200-40umBAS
a2A4200-40umPRO
a2A4504-5gcBAS BslColorSpacec
a2A4504-5gcPRO BslColorSpacec
a2A4504-5gmBAS
a2A4504-5gmPRO
a2A4504-18ucBAS BslColorSpacec
a2A4504-18ucPRO BslColorSpacec
a2A4504-18umBAS
a2A4504-18umPRO
a2A4504-27g5cBAS BslColorSpacec
a2A4504-27g5mBAS
a2A4504-42cc BslColorSpacec
a2A4504-42cm
a2A4508-6gcBAS BslColorSpacec
a2A4508-6gcPRO BslColorSpacec
a2A4508-6gmBAS
a2A4508-6gmPRO
a2A4508-20ucBAS BslColorSpacec
a2A4508-20ucPRO BslColorSpacec
a2A4508-20umBAS
a2A4508-20umPRO
a2A5060-4gcBAS BslColorSpacec
a2A5060-4gmBAS
a2A5060-15ucBAS BslColorSpacec
a2A5060-15umBAS
a2A5060-21g5cBAS BslColorSpacec
a2A5060-21g5mBAS
a2A5320-7gcBAS BslColorSpacec
a2A5320-7gcPRO BslColorSpacec
a2A5320-7gmBAS
a2A5320-7gmPRO
a2A5320-23ucBAS BslColorSpacec
a2A5320-23ucPRO BslColorSpacec
a2A5320-23umBAS
a2A5320-23umPRO
a2A5320-34g5cBAS BslColorSpacec
a2A5320-34g5mBAS
a2A5320-52cc BslColorSpacec
a2A5320-52cm
a2A5328-4gcBAS BslColorSpacec
a2A5328-4gcPRO BslColorSpacec
a2A5328-4gmBAS
a2A5328-4gmPRO
a2A5328-15ucBAS BslColorSpacec
a2A5328-15ucPRO BslColorSpacec
a2A5328-15umBAS
a2A5328-15umPRO
a2A5328-22g5cBAS BslColorSpacec
a2A5328-22g5mBAS
a2A5328-35cc BslColorSpacec
a2A5328-35cm
acA640-121gm GammaEnable
GammaSelector
acA640-300gc GammaEnable
GammaSelector
acA640-300gm GammaEnable
GammaSelector
acA640-750uc Nonea
acA640-750um Nonea
acA720-290gc GammaEnable
GammaSelector
acA720-290gm GammaEnable
GammaSelector
acA720-520uc Nonea
acA720-520um Nonea
acA800-200gc GammaEnable
GammaSelector
acA800-200gm GammaEnable
GammaSelector
acA800-510uc Nonea
acA800-510um Nonea
acA1280-60gc GammaEnable
GammaSelector
acA1280-60gm GammaEnable
GammaSelector
acA1300-60gc GammaEnable
GammaSelector
acA1300-60gm GammaEnable
GammaSelector
acA1300-60gmNIR GammaEnable
GammaSelector
acA1300-75gc GammaEnable
GammaSelector
acA1300-75gm GammaEnable
GammaSelector
acA1300-200uc Nonea
acA1300-200um Nonea
acA1440-73gc GammaEnable
GammaSelector
acA1440-73gm GammaEnable
GammaSelector
acA1440-220uc Nonea
acA1440-220um Nonea
acA1600-20gc GammaEnable
GammaSelector
acA1600-20uc Nonea
acA1600-60gc GammaEnable
GammaSelector
acA1600-60gm GammaEnable
GammaSelector
acA1920-25gc GammaEnable
GammaSelector
acA1920-25gm GammaEnable
GammaSelector
acA1920-25uc Nonea
acA1920-25um Nonea
acA1920-40gc GammaEnable
GammaSelector
acA1920-40gm GammaEnable
GammaSelector
acA1920-40uc Nonea
acA1920-40ucMED Nonea
acA1920-40um Nonea
acA1920-40umMED Nonea
acA1920-48gc GammaEnable
GammaSelector
acA1920-48gm GammaEnable
GammaSelector
acA1920-50gc GammaEnable
GammaSelector
acA1920-50gm GammaEnable
GammaSelector
acA1920-150uc Nonea
acA1920-150um Nonea
acA1920-155uc Nonea
acA1920-155ucMED Nonea
acA1920-155um Nonea
acA1920-155umMED Nonea
acA2000-50gc GammaEnable
GammaSelector
acA2000-50gm GammaEnable
GammaSelector
acA2000-165uc Nonea
acA2000-165um Nonea
acA2040-25gc GammaEnable
GammaSelector
acA2040-25gm GammaEnable
GammaSelector
acA2040-25gmNIR GammaEnable
GammaSelector
acA2040-35gc GammaEnable
GammaSelector
acA2040-35gm GammaEnable
GammaSelector
acA2040-55uc Nonea
acA2040-55um Nonea
acA2040-90uc Nonea
acA2040-90um Nonea
acA2040-90umNIR Nonea
acA2040-120uc Nonea
acA2040-120um Nonea
acA2440-20gc GammaEnable
GammaSelector
acA2440-20gm GammaEnable
GammaSelector
acA2440-35uc Nonea
acA2440-35ucMED Nonea
acA2440-35um Nonea
acA2440-35umMED Nonea
acA2440-75uc Nonea
acA2440-75ucMED Nonea
acA2440-75um Nonea
acA2440-75umMED Nonea
acA2500-14gc GammaEnable
GammaSelector
acA2500-14gm GammaEnable
GammaSelector
acA2500-14uc Nonea
acA2500-14um Nonea
acA2500-20gc GammaEnable
GammaSelector
acA2500-20gcMED GammaEnable
GammaSelector
acA2500-20gm GammaEnable
GammaSelector
acA2500-20gmMED GammaEnable
GammaSelector
acA2500-60uc Nonea
acA2500-60um Nonea
acA3088-16gc GammaEnable
GammaSelector
acA3088-16gm GammaEnable
GammaSelector
acA3088-57uc Nonea
acA3088-57ucMED Nonea
acA3088-57um Nonea
acA3088-57umMED Nonea
acA3800-10gc GammaEnable
GammaSelector
acA3800-10gm GammaEnable
GammaSelector
acA3800-14uc Nonea
acA3800-14um Nonea
acA4024-8gc GammaEnable
GammaSelector
acA4024-8gm GammaEnable
GammaSelector
acA4024-29uc Nonea
acA4024-29um Nonea
acA4096-11gc GammaEnable
GammaSelector
acA4096-11gm GammaEnable
GammaSelector
acA4096-30uc Nonea
acA4096-30ucMED Nonea
acA4096-30um Nonea
acA4096-30umMED Nonea
acA4096-40uc Nonea
acA4096-40ucMED Nonea
acA4096-40um Nonea
acA4096-40umMED Nonea
acA4112-8gc GammaEnable
GammaSelector
acA4112-8gm GammaEnable
GammaSelector
acA4112-20uc Nonea
acA4112-20ucMED Nonea
acA4112-20um Nonea
acA4112-20umMED Nonea
acA4112-30uc Nonea
acA4112-30ucMED Nonea
acA4112-30um Nonea
acA4112-30umMED Nonea
acA5472-5gc GammaEnable
GammaSelector
acA5472-5gm GammaEnable
GammaSelector
acA5472-17uc Nonea
acA5472-17ucMED Nonea
acA5472-17um Nonea
acA5472-17umMED Nonea
boA1936-400cc BslColorSpacec
boA1936-400cm
boA2448-250cc BslColorSpacec
bo2448-250cm
boA2832-190cc BslColorSpacec
bo2832-190cm
boA4096-93cc BslColorSpacec
boA4096-93cm
boA4096-180cc BslColorSpacec
bo4096-180cm
boA4112-68cc BslColorSpacec
boA4112-68cm
boA4500-45cc BslColorSpacec
boA4500-45cm
boA4504-100cc BslColorSpacec
boA4504-100cm
boA5120-150cc 不支持 Gamma 功能
boA5120-150cm 不支持 Gamma 功能
boA5120-230cc 不支持 Gamma 功能
boA5120-230cm 不支持 Gamma 功能
boA5320-150cc BslColorSpacec
boA5320-150cm
boA5328-100cc BslColorSpacec
boA5328-100cm
boA6500-36cc BslColorSpacec
boA6500-36cm
boA8100-16cc BslColorSpacec
boA8100-16cm
boA9344-30cc 不支持 Gamma 功能
boA9344-30cm 不支持 Gamma 功能
boA9344-70cc 不支持 Gamma 功能
boA9344-70cm 不支持 Gamma 功能
boA13440-17cm
daA720-520uc BslColorSpacea
daA720-520um
daA1280-54uc BslColorSpaceMode b
daA1280-54um
daA1440-220uc BslColorSpacea
daA1440-220um
daA1600-60uc BslColorSpaceMode b
daA1600-60um
daA1920-15um
daA1920-30uc BslColorSpaceMode b
daA1920-30um
daA1920-160uc BslColorSpacea
daA1920-160um
daA2448-70uc BslColorSpacea
daA2448-70um
daA2500-14uc BslColorSpaceMode b
daA2500-14um
daA3840-45uc BslColorSpacea
daA3840-45um
dmA720-290gc BslColorSpacec
dmA720-290gm
dmA1440-73gc BslColorSpacec
dmA1440-73gm
dmA1920-51gc BslColorSpacec
dmA1920-51gm
dmA3536-9gc BslColorSpacec
dmA3536-9gm
puA1280-54uc BslColorSpaceMode b
puA1280-54um
puA1600-60uc BslColorSpaceMode b
puA1600-60um
puA1920-30uc BslColorSpaceMode b
puA1920-30um
puA2500-14uc BslColorSpaceMode b
puA2500-14um
r2L2048-29gc BslColorSpacec
r2L2048-58gm
r2L2048-62cc BslColorSpacec
r2L2048-62g5c BslColorSpacec
r2L2048-172cm
r2L2048-172g5m
r2L4096-14gc BslColorSpacec
r2L4096-29gm
r2L4096-42cc BslColorSpacec
r2L4096-42g5c BslColorSpacec
r2L4096-84cm
r2L4096-84g5m
r2L8192-200cm
r2L16384-120cm

  1. If you select a light source preset, an additional gamma correction value of approximately 0.4 is applied (sRGB gamma correction). This value is applied separately and not included in the Gamma parameter value. 示例: You have set the light source preset to Tungsten and the Gamma parameter value to 1.2. First, an automatic correction value of approximately 0.4 is applied to the pixel values. After that, a gamma correction value of 1.2 is applied to the resulting pixel values.

  2. 仅在像素格式设置为 YCbCr422 或 RGB8 时可用。

  3. If the color space is set to sRGB, a gamma correction value of approximately 0.4 is applied. This value is applied separately and not included in the Gamma parameter value. 示例: You set the color space to sRGB and the Gamma parameter to 1.2. First, an automatic correction value of approximately 0.4 is applied to the pixel values. After that, a gamma correction value of 1.2 is applied to the resulting pixel values.
    If you have selected a Light Source Preset, setting the color space to sRGB will also affect the Balance White, Color Adjustment, and Color Transformation features.

  4. If the color space is set to sRGB, a gamma correction value of approximately 0.4 is applied, the Gamma parameter becomes read-only, and the Gamma parameter value is ignored.

示例代码#

ace 2, boost, and dart R Cameras#
// Set the Gamma value to 1.2
camera.Gamma.SetValue(1.2);
// Set the color space to sRGB
camera.BslColorSpace.SetValue(BslColorSpace_sRGB);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Gamma value to 1.2
CFloatParameter(nodemap, "Gamma").SetValue(1.2);
// Set the color space to sRGB
CEnumParameter(nodemap, "BslColorSpace").SetValue("sRGB");
// Set the Gamma value to 1.2
camera.Parameters[PLCamera.Gamma].SetValue(1.2);
// Set the color space to sRGB
camera.Parameters[PLCamera.BslColorSpace].SetValue(PLCamera.BslColorSpace.sRGB);
/* 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 color space to sRGB */
errRes = PylonDeviceFeatureFromString(hdev, "BslColorSpace", "sRGB");
CHECK(errRes);
# Set the Gamma value to 1.2
camera.Gamma.Value = 1.2
# Set the color space to sRGB
camera.BslColorSpace.Value = "sRGB"
ace Classic/U/L GigE 相机#
// Enable the Gamma feature
camera.GammaEnable.SetValue(true);
// Set the gamma type to User
camera.GammaSelector.SetValue(GammaSelector_User);
// Set the Gamma value to 1.2
camera.Gamma.SetValue(1.2);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the Gamma feature
CBooleanParameter(nodemap, "GammaEnable").SetValue(true);
// Set the gamma type to User
CEnumParameter(nodemap, "GammaSelector").SetValue("User");
// Set the Gamma value to 1.2
CFloatParameter(nodemap, "Gamma").SetValue(1.2);
// Enable the Gamma feature
camera.Parameters[PLCamera.GammaEnable].SetValue(true);
// Set the gamma type to User
camera.Parameters[PLCamera.GammaSelector].SetValue(PLCamera.GammaSelector.User);
// 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 */
/* Enable the Gamma feature */
errRes = PylonDeviceSetBooleanFeature(hdev, "GammaEnable", 1);
CHECK(errRes);
/* Set the gamma type to User */
errRes = PylonDeviceFeatureFromString(hdev, "GammaSelector", "User");
CHECK(errRes);
/* Set the Gamma value to 1.2 */
errRes = PylonDeviceSetFloatFeature(hdev, "Gamma", 1.2);
CHECK(errRes);
# Enable the Gamma feature
camera.GammaEnable.Value = True
# Set the gamma type to User
camera.GammaSelector.Value = "User"
# Set the Gamma value to 1.2
camera.Gamma.Value = 1.2
其他相机#
// 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

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