跳转到内容
STAGING SERVER
DEVELOPMENT SERVER

pylon 会自动校正浮点值#

当您尝试设置一个不符合参数步长 (increment) 设置的浮点值时,pylon 不会给出错误消息,而是会自动将其校正为最接近的可能值。

这适用于 Basler pylon Viewer 和 API。

例如,a2A3840-45ucPRO 的 Exposure Time 步长为 9 µs。

如果您将其设置为 16 µs,您不会收到错误消息,但实际的 Exposure Time 将为 12 µs。

为什么自动校正会选择 12 µs 而不是 18 µs?

  • 这款特定相机的最小 Exposure Time 为 12 µs。
  • 步长为 9 µs,下一个可能的值为 21 µs。
  • 目标值为 16 µs,与 21 µs 相差 5 µs,但距离 12 µs 仅相差 4 µs。因此,最近邻算法会选择 12 µs 作为 Exposure Time。

使用 API 命令的示例如下:

double val = 16;

Console.WriteLine(" trying to set value " + val);
camera.Parameters[PLCamera.ExposureTime].SetValue(val);
Console.WriteLine(" current increment " +
 camera.Parameters[PLCamera.ExposureTime].GetIncrement());
Console.WriteLine("Current Exposure time is : " +
 camera.Parameters[PLCamera.ExposureTime].GetValue());

Exposure Time 12 µs

当目标曝光值设定为 30 µs 时,不会出现问题,因为这是一个接受的值(12 + 2 x 9 = 30 µs)

double val = 30;

Exposure Time 30 µs

返回知识库文章