跳转到内容

Triggered Image Acquisition (dart E)#

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

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

该功能的使用#

硬件触发和软件触发#

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

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

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

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

配置触发图像采集#

要配置触发图像采集:

  1. Set the TriggerMode parameter to On to enable triggered image acquisition.
  2. 配置触发器:
    1. Set the TriggerSource parameter to define which signal triggers the trigger.
    2. If applicable, set the TriggerActivation parameter to define which signal transition triggers the trigger.

信息

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

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

Trigger Source#

You can set the trigger source using the TriggerSource parameter.

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

可以使用以下触发源:

硬件 Trigger Source#

  • Line1: The trigger selected can be triggered by applying an electrical signal to I/O line 1.
  • PeriodicSignal1: The trigger selected can be triggered using the Periodic Signal feature.

软件 Trigger Source#

  • Software: The trigger selected can be triggered by executing a TriggerSoftware command via the pylon API.

触发激活模式#

You can set the activation mode using the TriggerActivation parameter.

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

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

  • LevelHigh: The trigger is active as long as the trigger signal is high.
  • LevelLow: The trigger is active as long as the trigger signal is 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 轻松设置参数。