跳至內容
測試伺服器
開發伺服器

觸發式影像擷取 (dart E)#

如果相機設定為觸發式影像擷取,您可以於特定時間點觸發影像擷取。

大多數現代影像應用皆採用觸發式影像擷取。

使用此功能#

硬體與軟體觸發#

當相機設定為 硬體 觸發時,施加至相機其中一個輸入線路的 電氣訊號 可作為觸發訊號。

當相機設定為 軟體 觸發時,軟體指令或訊號 會作為觸發訊號。此軟體指令可透過 pylon API 執行。

就設定而言,硬體與軟體觸發唯一的差別在於觸發來源。針對硬體觸發,您必須選擇 硬體觸發來源。針對軟體觸發,您必須選擇 軟體觸發來源。

此外,某些設定步驟不適用於軟體觸發,例如選擇 Trigger Activation Mode。

設定觸發式影像擷取#

若要設定觸發式影像擷取:

  1. 將 TriggerMode 參數設為 On 以啟用觸發式影像擷取。
  2. 設定觸發:
    1. 將 TriggerSource 用於定義的 Property 哪個訊號 觸發觸發源。
    2. 如適用,請設定 TriggerActivation 用於定義的 Property 哪個訊號轉換 觸發觸發源。

資訊

  • 觸發相機的速率切勿超過下列一項或兩項限制因素:

    • 目前相機設定允許的最大影格率。如果您在相機尚未準備好接收時向其發送 Frame Start 觸發訊號,這些訊號將會被忽略。
    • 主機電腦用於資料傳輸、儲存或兩者的容量限制。如果您嘗試擷取主機電腦無法處理的更多影像,可能會遺失影格。

Trigger Sources#

您可以使用以下方式設定 Trigger Source: TriggerSource 參數來啟用它。

這定義了觸發如何被觸發how。

以下是可用的 Trigger Source:

硬體觸發來源#

  • Line1:透過對 I/O 線路 1 施加電氣信號,可以觸發所選的觸發。
  • PeriodicSignal1:可以使用以下方式觸發所選的觸發: Periodic Signal 功能。

軟體觸發來源#

  • Software:透過執行 TriggerSoftware 命令(透過 pylon API)來觸發所選的觸發。

Trigger Activation Modes#

您可以使用以下方式設定啟動模式: TriggerActivation 參數來啟用它。

此設定僅適用於硬體觸發。它定義了哪個信號轉態會啟動所選的觸發。例如,您可以指定當觸發信號下降時,觸發會變為有效。

以下是可用的 Trigger Activation 模式:

  • LevelHigh:觸發處於有效狀態 只要 觸發信號為 高電位.
  • LevelLow:觸發處於有效狀態 只要 觸發信號為 低電位.

範例程式碼#

// 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 輕鬆設定參數。