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

觸發影像擷取 (dart E)#

若相機設定為觸發影像擷取,您可以在特定時間點觸發影像擷取。

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

使用此功能#

硬體與軟體觸發#

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

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

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

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

設定觸發影像擷取#

若要設定觸發影像擷取:

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

資訊

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

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

Trigger Source#

您可以使用以下方式設定 Trigger Source TriggerSource 參數的值。

這定義了 如何 觸發觸發程序。

以下是可用的 Trigger Source:

硬體觸發來源#

  • Line1:透過對 I/O 線路 1 施加電氣訊號,即可觸發所選的觸發器。
  • PeriodicSignal1:可以使用以下方式觸發所選的觸發器: Periodic Signal feature 定義的設定。

軟體觸發來源#

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

Trigger Activation#

您可以使用以下方式設定啟用模式: TriggerActivation 參數的值。

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

以下是可用的 Trigger Activation 模式:

  • LevelHigh:觸發器處於啟用狀態 只要 觸發訊號為 High.
  • 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 輕鬆設定參數。