双 ROI#
仅会传输这些分区的像素数据,这样可以提高相机的帧速率。
此功能仅适用于 Basler boost V 相机型号。
该功能的使用#
运作原理#
通过 Dual ROI 功能,您可以在垂直方向上定义传感器阵列上的两个区域。
采集图像时,仅从传感器读出分区内的像素信息,然后作为单个图像发送。
- 可以分别为这两个区域定义高度和垂直偏移量。您可以通过配置传感器阵列上的行来实现这一点。
- 即: 宽度 和 水平偏移量 对于这两个区域,这些设置始终相同。它们由全局
OffsetX和WidthProperty。
在以下示例中,已定义了两行。这创建了两个区域:
区域 1 和区域 2 内部的像素信息将作为单个图像进行传输。
配置区域#
若要配置这些区域:
- 确保相机空闲,即未在捕获图像。
- 设置
BslDualROIRowsEnable参数至true. - 设置
BslDualROIRowSelector参数至Row1. - 设置
BslDualROIRowOffset参数设置为所需的行的垂直偏移量,例如 100。 - 设置
BslDualROIRowSize参数设置为所需的行高度,例如 50。 - 验证
BslDualROIImageValid参数为true的值。如果不是,请更改您的参数设置。
例如,各个区域不得重叠,且所有区域的总高度不得超过图像传感器的总高度。 - 对第 2 行重复上述步骤。
- 设置
OffsetX参数设置为两个区域所需的水平偏移量。 - 设置
Width参数设置为两个区域所需的宽度。
使用 Dual ROI 功能时的注意事项#
-
如果将
BslDualROIRowsEnable参数设置为true,每当启动图像采集时,系统会自动设置以下参数:OffsetY:该参数设置为第 1 行的垂直偏移量。Height:该参数设置为所有区域的总高度,即由 Dual ROI 功能创建的图像的高度。
在使用 Dual ROI 功能期间更改这些参数是可能的,但不会生效。
-
Auto Function ROI 的位置和大小不会自动适应 Dual ROI 功能的输出。如果您正在使用自动功能,请确保 Dual ROI 区域包含在 Auto Function ROI 内部。
示例代码#
// ** In this example, we define two regions in vertical direction
// that will be transmitted as a single image. **
// Enable the Dual ROI feature
camera.BslDualROIRowsEnable.SetValue(true);
// Select row 1
camera.BslDualROIRowSelector.SetValue(BslDualROIRowSelector_Row1);
// The first region should have a vertical offset of 100 and a height of 300 pixels
camera.BslDualROIRowOffset.SetValue(100);
camera.BslDualROIRowSize.SetValue(300);
// Select row 2
camera.BslDualROIRowSelector.SetValue(BslDualROIRowSelector_Row1);
// The second region should have a vertical offset of 500 and a height of 400 pixels
camera.BslDualROIRowOffset.SetValue(500);
camera.BslDualROIRowSize.SetValue(400);
// Check whether the outgoing image is valid
bool heightValid = camera.BslDualROIImageValid.GetValue();
// Both regions should have a horizontal offset of 200 and a width of 500
camera.OffsetX.SetValue(200);
camera.Width.SetValue(500);
INodeMap& nodemap = camera.GetNodeMap();
// ** In this example, we define two regions in vertical direction
// that will be transmitted as a single image. **
// Enable the Dual ROI feature
CBooleanParameter(nodemap, "BslDualROIRowsEnable").SetValue(true);
// Select row 1
CEnumParameter(nodemap, "BslDualROIRowSelector").SetValue("Row1");
// The first region should have a vertical offset of 100 and a height of 300 pixels
CIntegerParameter(nodemap, "BslDualROIRowOffset").SetValue(100);
CIntegerParameter(nodemap, "BslDualROIRowSize").SetValue(300);
// Select row 2
CEnumParameter(nodemap, "BslDualROIRowSelector").SetValue("Row1");
// The second region should have a vertical offset of 500 and a height of 400 pixels
CIntegerParameter(nodemap, "BslDualROIRowOffset").SetValue(500);
CIntegerParameter(nodemap, "BslDualROIRowSize").SetValue(400);
// Check whether the outgoing image is valid
bool heightValid = CBooleanParameter(nodemap, "BslDualROIImageValid").GetValue();
// Both regions should have a horizontal offset of 200 and a width of 500
CIntegerParameter(nodemap, "OffsetX").SetValue(200);
CIntegerParameter(nodemap, "Width").SetValue(500);
// ** In this example, we define two regions in vertical direction
// that will be transmitted as a single image. **
// Enable the Dual ROI feature
camera.Parameters[PLCamera.BslDualROIRowsEnable].SetValue(true);
// Select row 1
camera.Parameters[PLCamera.BslDualROIRowSelector].SetValue(PLCamera.BslDualROIRowSelector.Row1);
// The first region should have a vertical offset of 100 and a height of 300 pixels
camera.Parameters[PLCamera.BslDualROIRowOffset].SetValue(100);
camera.Parameters[PLCamera.BslDualROIRowSize].SetValue(300);
// Select row 2
camera.Parameters[PLCamera.BslDualROIRowSelector].SetValue(PLCamera.BslDualROIRowSelector.Row1);
// The second region should have a vertical offset of 500 and a height of 400 pixels
camera.Parameters[PLCamera.BslDualROIRowOffset].SetValue(500);
camera.Parameters[PLCamera.BslDualROIRowSize].SetValue(400);
// Check whether the outgoing image is valid
bool heightValid = camera.Parameters[PLCamera.BslDualROIImageValid].GetValue();
// Both regions should have a horizontal offset of 200 and a width of 500
camera.Parameters[PLCamera.OffsetX].SetValue(200);
camera.Parameters[PLCamera.Width].SetValue(500);
/* 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 */
_Bool heightValid = false;
/* ** In this example, we define two regions in vertical direction */
/* that will be transmitted as a single image. ** */
/* Enable the Dual ROI feature */
errRes = PylonDeviceSetBooleanFeature(hdev, "BslDualROIRowsEnable", 1);
CHECK(errRes);
/* Select row 1 */
errRes = PylonDeviceFeatureFromString(hdev, "BslDualROIRowSelector", "Row1");
CHECK(errRes);
/* The first region should have a vertical offset of 100 and a height of 300 pixels */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslDualROIRowOffset", 100);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "BslDualROIRowSize", 300);
CHECK(errRes);
/* Select row 2 */
errRes = PylonDeviceFeatureFromString(hdev, "BslDualROIRowSelector", "Row1");
CHECK(errRes);
/* The second region should have a vertical offset of 500 and a height of 400 pixels */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslDualROIRowOffset", 500);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "BslDualROIRowSize", 400);
CHECK(errRes);
/* Check whether the outgoing image is valid */
errRes = PylonDeviceGetBooleanFeature(hdev, "BslDualROIImageValid", &heightValid);
CHECK(errRes);
/* Both regions should have a horizontal offset of 200 and a width of 500 */
errRes = PylonDeviceSetIntegerFeature(hdev, "OffsetX", 200);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 500);
CHECK(errRes);
# ** In this example, we define two regions in vertical direction
# that will be transmitted as a single image. **
# Enable the Dual ROI feature
camera.BslDualROIRowsEnable.Value = True
# Select row 1
camera.BslDualROIRowSelector.Value = "Row1"
# The first region should have a vertical offset of 100 and a height of 300 pixels
camera.BslDualROIRowOffset.Value = 100
camera.BslDualROIRowSize.Value = 300
# Select row 2
camera.BslDualROIRowSelector.Value = "Row1"
# The second region should have a vertical offset of 500 and a height of 400 pixels
camera.BslDualROIRowOffset.Value = 500
camera.BslDualROIRowSize.Value = 400
# Check whether the outgoing image is valid
heightValid = camera.BslDualROIImageValid.Value
# Both regions should have a horizontal offset of 200 and a width of 500
camera.OffsetX.Value = 200
camera.Width.Value = 500
您也可以使用 pylon Viewer 轻松设置参数。