跳转到内容
STAGING SERVER
DEVELOPMENT SERVER

User-Defined Data#

The User-Defined Data camera feature allows you to store user-defined data in the camera.

该功能的使用#

运作原理#

You have three options to store user-defined data in the camera:

配置 User-Defined Values#

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

The values are named Value1 to Value5.

要配置用户定义的值:

  1. Set the UserDefinedValueSelector parameter to the desired user-defined value, e.g. Value1.
  2. 输入 UserDefinedValue 参数所需的值。

设置设备用户 ID#

With the DeviceUserID parameter, you can assign a user-defined name to a camera.

To assign a user-defined name to a camera:

  1. Enter a name for the DeviceUserID in the Device Control category. The DeviceUserID can consist of any combination of numbers, letters, and spaces.

For GigE cameras, you can set the DeviceUserID also in the pylon IP Configurator.

On USB 3.0 cameras, you must reset the camera using the DeviceReset command for the changes to take effect.

See also information about other device information parameters.

Storing User Data as a Binary File#

You can store binary data on your camera (up to approximately 200 kB on ace 2 cameras) on your camera. This data is saved as a separate file called User Data and is transferred using the File Access function in the pylon Viewer.

Examples of typical user data:

  • Calibration data
  • Shading correction data

Uploading User Data to the Camera#

To upload a user data file using the pylon Viewer:

  1. In the pylon Viewer, open the camera you want to upload the user data file to.
  2. 在 pylon Viewer 的相机菜单中,单击文件访问权限
  3. In the Camera File drop-down box, select User Data.
  4. Click Upload and navigate to the file that you want to upload. The file must have the file ending *.dll.
  5. 单击打开
  6. Close the Camera File Access dialog.

The file is stored on your camera.

Downloading User Data from the Camera#

To download a user data file using the pylon Viewer:

  1. In the pylon Viewer, open the camera you want to download the user data file from.
  2. 在 pylon Viewer 的相机菜单中,单击文件访问权限
  3. In the Camera File drop-down box, select User Data.
  4. Click Download, navigate to the directory where you want to save the file, and enter the desired file name with the file ending *.dll.
  5. Click Save.
  6. Close the Camera File Access dialog.

The file is downloaded to the defined directory.

示例代码#

// Select user-defined value 1
camera.UserDefinedValueSelector.SetValue(UserDefinedValueSelector_Value1);
// Set the value for the UserDefinedValue parameter
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();
// Select user-defined value 1
CEnumParameter(nodemap, "UserDefinedValueSelector").SetValue("Value1");
// Set the value for the UserDefinedValue parameter
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();
// Select user-defined value 1
camera.Parameters[PLCamera.UserDefinedValueSelector].SetValue(PLCamera.UserDefinedValueSelector.Value1);
// Set the value for the UserDefinedValue parameter
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;
/* Select user-defined value 1 */
errRes = PylonDeviceFeatureFromString(hdev, "UserDefinedValueSelector", "Value1");
CHECK(errRes);
/* Set the value for the UserDefinedValue parameter */
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);
# Select user-defined value 1
camera.UserDefinedValueSelector.Value = "Value1"
# Set the value for the UserDefinedValue parameter
camera.UserDefinedValue.Value = 1000
# Get the value of user-defined value 1
camera.UserDefinedValueSelector.Value = "Value1"
UserValue1 = camera.UserDefinedValue.Value

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