跳转到内容

Stacked Zone Imaging#

相机的 Stacked Zone Imaging 功能允许您在传感器阵列上定义多达八个分区,这些分区将作为单个图像传输。

仅有这些分区的像素数据会被传输。这样可以提高相机的帧速率

该功能的使用#

运作原理#

Stacked Zone Imaging 功能允许您在传感器阵列上最多定义八个等宽的垂直对齐分区。采集图像时,仅从指定的分区内读出像素信息。然后将像素信息汇总在一起并作为单个图像发送。

Stacked Zone Imaging 示例

这些分区始终具有相同的宽度并垂直对齐。要配置 ROI 分区,Basler 建议执行以下程序:

  1. 定义对所有分区均有效的宽度和水平偏移。
  2. 定义各个分区的高度和垂直偏移。

配置 Stacked Zone Imaging#

  1. 禁用 Center X and Center YDecimation 功能(如果可用)。
  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 放置在中间。但是,相机始终会从传感器的最上方区域开始读出并传输像素数据,然后逐步向下方移动。
  • 您可以定义垂直重叠的分区。如果两个分区重叠,则将它们作为一个合并的分区发送。来自重叠区的像素数据仅被读出并发送一次。
  • 您可以在单色相机上按照一个增量设置 StackedZoneImagingZoneOffsetYStackedZoneImagingZoneHeight 参数;在彩色相机上按两个增量设置这两个参数。对于彩色相机,参数值必须为偶数。
  • 在 Stacked Zone Imaging 启用后,以下参数将变为只读:
    • OffsetY
      将参数设置为最上方区域的垂直偏移。
    • Height
      该参数设置为最终图像的高度,即所有分区的高度之和。
    • CenterY
  • 如果启用了 Stacked Zone Imaging 功能,然后启用了像素合并,可以自动调整层叠分区的位置和大小。参数值除以相应的合并系数并四舍五入。
  • 如果在使用层叠分区成像功能后禁用所有分区,则图像 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

您也可以使用 pylon Viewer 轻松设置参数。