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

Stacked Zone Imaging#

「Stacked Zone Imaging 」相機功能可讓您在感光元件陣列上定義最多八個區域,這些區域將被整合為單一影像進行傳輸。

系統僅會傳輸這些區域的像素資料。這能提高相機的幀率。

使用功能#

運作原理#

「Stacked Zone Imaging 」功能可讓您在感測器陣列上定義最多八個寬度相等且垂直對齊的區域。當擷取影像時,系統僅會從感測器中讀出定義區域內的像素資訊。隨後,這些像素資訊會被疊加在一起,並作為單一影像傳輸出去。

Stacked Zone Imaging 範例

這些區域的寬度始終相同,並且垂直對齊。要設定 ROI 區域,Basler 建議採用以下步驟:

  1. 定義一個適用於所有區域的寬度與水平偏移量。
  2. 請定義各區域的高度與垂直偏移量。

設定Stacked Zone Imaging#

  1. 停用 Center X and Center Y 以及 Decimation 功能(如有提供)。
  2. 將相機中的 StackedZoneImagingEnable 參數設為 true.
    Stacked Zone Imaging 功能已啟用,並可進行設定。
  3. 將相機中的 OffsetX 將參數設定為所需的水平偏移量。該數值將套用至 所有區域.
  4. 將相機中的 Width 將參數設定為所需的區間寬度。該值將套用至 所有區域.
  5. 將相機中的 StackedZoneImagingIndex 要設定的區域參數,例如 1。
  6. 將相機中的 StackedZoneImagingZoneEnable 參數設為 true 以啟用在步驟 4 中選取的區域。
  7. 將相機中的 StackedZoneImagingZoneOffsetY 將參數設定為所需的垂直偏移量。該數值將套用至步驟 4 中選取的區域。
  8. 將相機中的 StackedZoneImagingZoneHeight 將參數設定為所需的區域高度。
    該數值將套用至步驟 4 中選取的區域。
  9. 針對您要設定的每個區域,請重複步驟 4 至 7。

使用時的注意事項Stacked Zone Imaging#

  • 您可以依照任何您喜歡的順序啟用各區域。例如,您可以啟用第 2、4 和 6 區,並停用第 1、3 和 5 區。
  • 您可以自由地在感光元件周圍配置各區塊。例如,您可以將第 1 區塊置於底部附近、第 3 區塊置於頂部附近,而第 2 區塊則置於中間。然而,相機總是會從感光元件最頂端的區塊開始讀取並傳輸像素資料,然後依序向下進行。
  • 您可以定義垂直重疊的區域。若兩個區域重疊,則會作為單一合併區域傳輸。重疊區域的像素資料僅會讀取並傳輸一次。
  • 您可以設定 StackedZoneImagingZoneOffsetY 進行明確的生命週期管理即呼叫 StackedZoneImagingZoneHeight 在單色攝影機上,參數以 1 為增量;在彩色攝影機上,則以 2 為增量。對於彩色攝影機,參數值必須為偶數。
  • 當啟用「Stacked Zone Imaging 」功能時,以下參數將轉為唯讀:
    • OffsetY
      此參數設定為最上層區域的垂直偏移量。
    • Height
      此參數設定為最終影像的高度,亦即所有區域高度的總和。
    • CenterY
  • 若您已啟用「Stacked Zone Imaging 」功能,隨後再啟用分桶(binning),系統會自動調整堆疊區的位置與大小。參數值將除以對應的分桶係數,並向下取整。
  • 若在使用「堆疊區域成像」功能後停用所有區域,影像 ROI的大小與位置將設定為最後一個被停用的區域的大小與位置。 舉例來說,假設區域 0、1 和 2 目前處於啟用狀態。接著,您依序停用區域 2、1、0。因此,影像 ROI 的大小與位置將設定為被停用的區域 0 的大小與位置。

範例程式碼#

// Enable stacked zone imaging
camera.StackedZoneImagingEnable.SetValue(true);
// Configure width and offset X for all zones
camera.Width.SetValue(200);
camera.OffsetX.SetValue(100);
// Select zone 1
camera.StackedZoneImagingIndex.SetValue(1);
// Enable the selected zone
camera.StackedZoneImagingZoneEnable.SetValue(true);
// Set the vertical offset for the selected zone
camera.StackedZoneImagingZoneOffsetY.SetValue(100);
// Set the height for the selected zone
camera.StackedZoneImagingZoneHeight.SetValue(100);
// Select zone 2
camera.StackedZoneImagingIndex.SetValue(2);
// Enable the selected zone
camera.StackedZoneImagingZoneEnable.SetValue(true);
// Set the offset Y for the selected zone
camera.StackedZoneImagingZoneOffsetY.SetValue(250);
// Set the height for the selected zone
camera.StackedZoneImagingZoneHeight.SetValue(200);
INodeMap& nodemap = camera.GetNodeMap();
// Enable stacked zone imaging
CBooleanParameter(nodemap, "StackedZoneImagingEnable").SetValue(true);
// Configure width and offset X for all zones
CIntegerParameter(nodemap, "Width").SetValue(200);
CIntegerParameter(nodemap, "OffsetX").SetValue(100);
// Select zone 1
CIntegerParameter(nodemap, "StackedZoneImagingIndex").SetValue(1);
// Enable the selected zone
CBooleanParameter(nodemap, "StackedZoneImagingZoneEnable").SetValue(true);
// Set the vertical offset for the selected zone
CIntegerParameter(nodemap, "StackedZoneImagingZoneOffsetY").SetValue(100);
// Set the height for the selected zone
CIntegerParameter(nodemap, "StackedZoneImagingZoneHeight").SetValue(100);
// Select zone 2
CIntegerParameter(nodemap, "StackedZoneImagingIndex").SetValue(2);
// Enable the selected zone
CBooleanParameter(nodemap, "StackedZoneImagingZoneEnable").SetValue(true);
// Set the offset Y for the selected zone
CIntegerParameter(nodemap, "StackedZoneImagingZoneOffsetY").SetValue(250);
// Set the height for the selected zone
CIntegerParameter(nodemap, "StackedZoneImagingZoneHeight").SetValue(200);
// Enable stacked zone imaging
camera.Parameters[PLCamera.StackedZoneImagingEnable].SetValue(true);
// Configure width and offset X for all zones
camera.Parameters[PLCamera.Width].SetValue(200);
camera.Parameters[PLCamera.OffsetX].SetValue(100);
// Select zone 1
camera.Parameters[PLCamera.StackedZoneImagingIndex].SetValue(1);
// Enable the selected zone
camera.Parameters[PLCamera.StackedZoneImagingZoneEnable].SetValue(true);
// Set the vertical offset for the selected zone
camera.Parameters[PLCamera.StackedZoneImagingZoneOffsetY].SetValue(100);
// Set the height for the selected zone
camera.Parameters[PLCamera.StackedZoneImagingZoneHeight].SetValue(100);
// Select zone 2
camera.Parameters[PLCamera.StackedZoneImagingIndex].SetValue(2);
// Enable the selected zone
camera.Parameters[PLCamera.StackedZoneImagingZoneEnable].SetValue(true);
// Set the offset Y for the selected zone
camera.Parameters[PLCamera.StackedZoneImagingZoneOffsetY].SetValue(250);
// Set the height for the selected zone
camera.Parameters[PLCamera.StackedZoneImagingZoneHeight].SetValue(200);
/* 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 stacked zone imaging */
errRes = PylonDeviceSetBooleanFeature(hdev, "StackedZoneImagingEnable", 1);
CHECK(errRes);
/* Configure width and offset X for all zones */
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 200);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "OffsetX", 100);
CHECK(errRes);
/* Select zone 1 */
errRes = PylonDeviceSetIntegerFeature(hdev, "StackedZoneImagingIndex", 1);
CHECK(errRes);
/* Enable the selected zone */
errRes = PylonDeviceSetBooleanFeature(hdev, "StackedZoneImagingZoneEnable", 1);
CHECK(errRes);
/* Set the vertical offset for the selected zone */
errRes = PylonDeviceSetIntegerFeature(hdev, "StackedZoneImagingZoneOffsetY", 100);
CHECK(errRes);
/* Set the height for the selected zone */
errRes = PylonDeviceSetIntegerFeature(hdev, "StackedZoneImagingZoneHeight", 100);
CHECK(errRes);
/* Select zone 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "StackedZoneImagingIndex", 2);
CHECK(errRes);
/* Enable the selected zone */
errRes = PylonDeviceSetBooleanFeature(hdev, "StackedZoneImagingZoneEnable", 1);
CHECK(errRes);
/* Set the offset Y for the selected zone */
errRes = PylonDeviceSetIntegerFeature(hdev, "StackedZoneImagingZoneOffsetY", 250);
CHECK(errRes);
/* Set the height for the selected zone */
errRes = PylonDeviceSetIntegerFeature(hdev, "StackedZoneImagingZoneHeight", 200);
CHECK(errRes);
# Enable stacked zone imaging
camera.StackedZoneImagingEnable.Value = True
# Configure width and offset X for all zones
camera.Width.Value = 200
camera.OffsetX.Value = 100
# Select zone 1
camera.StackedZoneImagingIndex.Value = 1
# Enable the selected zone
camera.StackedZoneImagingZoneEnable.Value = True
# Set the vertical offset for the selected zone
camera.StackedZoneImagingZoneOffsetY.Value = 100
# Set the height for the selected zone
camera.StackedZoneImagingZoneHeight.Value = 100
# Select zone 2
camera.StackedZoneImagingIndex.Value = 2
# Enable the selected zone
camera.StackedZoneImagingZoneEnable.Value = True
# Set the offset Y for the selected zone
camera.StackedZoneImagingZoneOffsetY.Value = 250
# Set the height for the selected zone
camera.StackedZoneImagingZoneHeight.Value = 200

您也可以 use the pylon Viewer 來輕鬆設定參數。