跳转到内容

User-Defined Values#

相机的 User-Defined Values 功能允许您将用户定义的值存储在相机中。

该功能的使用#

运作原理#

相机最多可以存储五个用户定义的值,它们可以是您的应用可能需要的值(例如,全景图像的光学参数值)。这些值是您可以根据需要设置和获取的 32 位有符号整数值。它们充当存储位置,对相机的操作没有影响。

这些值以 Value1 到 Value5 命名。

配置 User-Defined Values#

要配置用户定义的值:

  1. UserDefinedValueSelector 参数设置为所需的用户定义值(Value1Value5)。
  2. 输入 UserDefinedValue 参数所需的值。

示例代码#

// Selct user-defined value 1
camera.UserDefinedValueSelector.SetValue(UserDefinedValueSelector_Value1);
camera.UserDefinedValue.SetValue(1000);
// Get the value of user-defined value 1
camera.UserDefinedValueSelector.SetValue(UserDefinedValueSelector_Value1);
int64_t UserValue1 = camera.UserDefinedValue.GetValue();
INodeMap& nodemap = camera.GetNodeMap();
// Selct user-defined value 1
CEnumParameter(nodemap, "UserDefinedValueSelector").SetValue("Value1");
CIntegerParameter(nodemap, "UserDefinedValue").SetValue(1000);
// Get the value of user-defined value 1
CEnumParameter(nodemap, "UserDefinedValueSelector").SetValue("Value1");
int64_t UserValue1 = CIntegerParameter(nodemap, "UserDefinedValue").GetValue();
// Selct user-defined value 1
camera.Parameters[PLCamera.UserDefinedValueSelector].SetValue(PLCamera.UserDefinedValueSelector.Value1);
camera.Parameters[PLCamera.UserDefinedValue].SetValue(1000);
// Get the value of user-defined value 1
camera.Parameters[PLCamera.UserDefinedValueSelector].SetValue(PLCamera.UserDefinedValueSelector.Value1);
Int64 UserValue1 = camera.Parameters[PLCamera.UserDefinedValue].GetValue();
/* 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 */
int64_t UserValue1 = 0;
/* Selct user-defined value 1 */
errRes = PylonDeviceFeatureFromString(hdev, "UserDefinedValueSelector", "Value1");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "UserDefinedValue", 1000);
CHECK(errRes);
/* Get the value of user-defined value 1 */
errRes = PylonDeviceFeatureFromString(hdev, "UserDefinedValueSelector", "Value1");
CHECK(errRes);
errRes = PylonDeviceGetIntegerFeature(hdev, "UserDefinedValue", &UserValue1);
CHECK(errRes);
# Selct user-defined value 1
camera.UserDefinedValueSelector.Value = "Value1"
camera.UserDefinedValue.Value = 1000
# Get the value of user-defined value 1
camera.UserDefinedValueSelector.Value = "Value1"
UserValue1 = camera.UserDefinedValue.Value

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