跳转到内容
暂存服务器
开发服务器

触发式图像采集 (dart E)#

如果将相机配置为触发图像采集,则可以在特定时间点触发图像拍摄。

现在大部分成像应用有用到触发图像采集。

该功能的使用#

硬件触发和软件触发#

如果相机配置为硬件触发,则施加到相机任意输入线路的电信号可以用作触发信号。

当相机配置为软件触发时,软件命令或信号将用作触发信号。可以使用 pylon API 执行软件命令。

在配置方面,硬件触发和软件触发的唯一区别在于 Trigger Source。对于硬件触发,您必须选择硬件 Trigger Source。对于软件触发,您必须选择软件 Trigger Source。

此外,某些配置步骤不适用于软件触发,例如选择 Trigger Activation 模式。

配置触发图像采集#

要配置触发图像采集:

  1. 设置 TriggerMode 参数至 On 以启用触发式图像采集。
  2. 配置触发器:
    1. 设置 TriggerSource 参数来定义 哪个信号 触发此触发器。
    2. 如果适用,请设置 TriggerActivation 参数来定义 哪个信号跳变 触发此触发器。

信息

  • 请勿以超过以下一个或两个限制因素的速率触发相机:

    • 当前相机设置允许的最大帧速率。如果在相机尚未准备好接收帧开始触发信号时将其应用到相机,该信号将被忽略。
    • 主机的数据传输和/或存储容量限制。如果您尝试采集的图像数量超出了主机的处理能力,则可能会丢帧。

Trigger Source#

您可以使用以下参数设置 Trigger Source: TriggerSource 参数的值。

此设置定义了如何激活触发。

可以使用以下触发源:

硬件 Trigger Source#

  • Line1:通过向 I/O line 1 施加电信号来触发所选的触发器。
  • PeriodicSignal1:可以使用以下方式触发所选的触发器: Periodic Signal 功能。

软件 Trigger Source#

  • Software:通过执行 TriggerSoftware 命令(通过 pylon API)来触发所选的触发器。

触发激活模式#

您可以使用以下参数设置激活模式: TriggerActivation 参数的值。

此设置仅适用于硬件触发。它定义了哪个信号转换可激活所选触发。例如,您可以指定触发信号下降时将触发变为活动状态。

可以使用以下触发激活模式:

  • LevelHigh:触发器处于激活状态 只要 触发信号为 高电平.
  • LevelLow:触发器处于激活状态 只要 触发信号为 低电平(low).

示例代码#

// Enable triggered image acquisition for the Frame Start trigger
camera.TriggerMode.SetValue(TriggerMode_On);
// Set the trigger source to Line 1
camera.TriggerSource.SetValue(TriggerSource_Line1);
// Set the trigger activation mode to level high
camera.TriggerActivation.SetValue(TriggerActivation_LevelHigh);
INodeMap& nodemap = camera.GetNodeMap();
// Enable triggered image acquisition for the Frame Start trigger
CEnumParameter(nodemap, "TriggerMode").SetValue("On");
// Set the trigger source to Line 1
CEnumParameter(nodemap, "TriggerSource").SetValue("Line1");
// Set the trigger activation mode to level high
CEnumParameter(nodemap, "TriggerActivation").SetValue("LevelHigh");
// Enable triggered image acquisition for the Frame Start trigger
camera.Parameters[PLCamera.TriggerMode].SetValue(PLCamera.TriggerMode.On);
// Set the trigger source to Line 1
camera.Parameters[PLCamera.TriggerSource].SetValue(PLCamera.TriggerSource.Line1);
// Set the trigger activation mode to level high
camera.Parameters[PLCamera.TriggerActivation].SetValue(PLCamera.TriggerActivation.LevelHigh);
/* 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 triggered image acquisition for the Frame Start trigger */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerMode", "On");
CHECK(errRes);
/* Set the trigger source to Line 1 */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSource", "Line1");
CHECK(errRes);
/* Set the trigger activation mode to level high */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerActivation", "LevelHigh");
CHECK(errRes);
# Enable triggered image acquisition for the Frame Start trigger
camera.TriggerMode.Value = "On"
# Set the trigger source to Line 1
camera.TriggerSource.Value = "Line1"
# Set the trigger activation mode to level high
camera.TriggerActivation.Value = "LevelHigh"

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