TDI (Time Delay Integration)#
TDI 提高了光敏度,并可生成具有更宽动态范围的更亮图像,使其非常适合在微光条件下使用。
信息
此功能仅适用于 Basler racer 2 XL 和 racer 2 L mono 相机。
该功能的使用#
此功能的实现因相机而异:
racer 2 XL 相机#
racer 2 XL 相机配备了 TDI 传感器。TDI 传感器由多行像素组成,称为级(stages),它们排列成一个阵列。
当物体穿过传感器的视场时,其图像会从第一级的曝光区域投影到最后一级的曝光区域。这些级不是逐个单独曝光的,而是作为一个整体块曝光。因此,传感器会在每个级上对同一物体进行曝光,并累积和传输电荷,直到它们到达读出线。
以下插图直观地展示了四级传感器内的电荷传输。
从一级到下一级的电荷传输必须与物体的运动保持精确同步。这可确保连续曝光和电荷积分。物体的曝光时间与其在相机视场中的停留时间一样长。使用的级数越多,有效的 Exposure Time 和积分时间就越长。
以下插图显示了 TDI 传感器的视场及其电荷转移原理:
Number Of Stages#
级数决定了电荷从一级累积并转移到下一级直至到达最后一级的频率。级数越高,图像灵敏度越高。例如,如果级数设置为 256,则相机获取图像的灵敏度将提高 256 倍。级数还会影响最终的 Exposure Time。
可以设置传感器以不同的级数运行,例如 4 级或最多 256 级。可用的级数取决于所使用的传感器。
若要设置级数,请将 BslTDINumberOfStages 参数值设置为例如 Stages4 或 Stages256.
信息
在 Area sensor acquisition mode 中,级数决定了图像高度。例如,将级数设置为 128 时,r2T16416-500cm 相机将在 Area sensor acquisition mode 下获取 16416 x 128 的“面阵”图像。
Scan Direction#
TDI 传感器的扫描方向必须与通过相机的物体移动方向保持同步。扫描方向必须与物体的移动方向相同,以确保连续曝光和电荷积累。
信息
关于如何设置扫描方向的说明假设相机上安装了镜头。镜头会使图像倒置。
要设置扫描方向,请设置 BslTDIScanDirection 参数设置为以下值:
Forward:通过传感器视场的物体将按照 正向 扫描方向进行扫描。它首先通过相机的底部,然后通过顶部。Reverse:通过传感器视场的物体将按照 反向 扫描方向进行扫描。它首先通过相机的顶部,然后通过底部。
Resulting Exposure Time#
在 TDI 传感器采集模式中,Exposure Time 不是通过 ExposureTime 参数设置的。相反,它由以下两个采集参数决定:
- Number of stages:定义物体在传感器的视场中停留的时间,在此期间电荷会累积并转移。
- Line rate:定义电荷从一个级转移到下一个级的速度。它还决定了各个级的积分时间。
这两个参数共同决定了总的曝光时间:
$$ \text{Exposure time} = \frac{\text{Number of stages}}{\text{Line rate}} $$
下表显示了在 500 kHz 的固定 Line rate 以及不同级数下的曝光时间示例:
| 级数 | Line Rate [kHz] | Exposure Time [µs] |
|---|---|---|
| 4 | 500 | 8 |
| 64 | 500 | 128 |
| 128 | 500 | 256 |
| 256 | 500 | 512 |
下表显示了在固定 128 级以及最高 500 kHz 的不同 Line rate 下的曝光时间示例:
| Line Rate [kHz] | 级数 | Exposure Time [µs] |
|---|---|---|
| 100 | 128 | 1280 |
| 200 | 128 | 640 |
| 400 | 128 | 320 |
| 500 | 128 | 256 |
由于级数和 Line rate 都会影响曝光时间,因此它们也会影响图像亮度(前提是触发与物体的移动正确同步,并且在像素饱和度限制之内):
- 较高的级数会增加曝光时间,从而导致积累更多电荷。图像会显得更亮。
- 较低的级数会减少曝光时间,从而导致积累较少电荷。图像会显得更暗。
- 较高的 Line rate 会减少每个级的曝光时间,从而导致积累较少电荷。图像会显得更暗。
- 较低的 Line rate 会增加每个级的曝光时间,从而导致积累更多电荷。图像会显得更亮。
为 TDI 配置 racer 2 XL 相机#
若要为 TDI 配置 racer 2 XL 相机:
- 设置
BslSensorAcquisitionMode将参数设置为TDISingleLine。该传感器使用一个读出线。 - 根据您的系统设置,将
BslTDIScanDirection参数设置为例如Forward. - 设置
BslTDINumberOfStages参数设置为例如 128。
信息
- 确保传感器的读出过程与物体移动的速度和方向完全同步。为了进行测试,请相应地更改 Acquisition Line Rate。这也会影响最终的 Exposure Time。
- 在触发暂停后重新触发时,必须认为至少前 n 个读出行为无效,其中 n 表示级数的最小值。
racer 2 L Mono 相机#
racer 2 L mono cameras 配备有多行传感器,即双线或四线传感器。传感器的每个像素行都可以设置为使用不同的 Exposure Time 进行曝光。每当触发采集时,传感器的所有像素行都会同时曝光。对于单次曝光,传感器中的每一行都会采集物体上的不同区域,因为对于流经相机的任何物体,每一行的视野都不同。
以下插图显示了单色四行传感器的视野。
在这种情况下,必须对来自四次不同采集的数据进行缓冲和组合,以获得物体上特定区域的完整信息。这是通过 Spatial Correction 完成的。将当前曝光最后一行的的数据与过去曝光中获取的前几行的数据相结合。
使用 Line Combination Mode,您最终可以指定组合各个行的像素值以获得 HDR 图像的方式。
Line Combination Mode#
Line Combination Mode 允许您定义是将组合传感器行的像素值相加还是取平均值。您可以将 BslLineCombinationMode 参数设置为以下值:
Off:禁用行组合。TDISum:将组合传感器行的像素值相加。这会增加相机对光的响应以及信噪比。TDIAverage:对组合传感器行的像素值求平均值。这会在不影响相机对光响应的情况下提高信噪比。
为 TDI 配置 racer 2 L Mono 相机#
若要为 TDI 配置 racer 2 L mono 相机:
- 设置 传感器采集模式 转至双线或四线图像采集:
设置BslSensorAcquisitionMode将参数设置为DualLine或QuadLine取决于您是想将两行还是四行用于 TDI。 -
指定每一行(级)的 Exposure Time:
- 设置
ExposureTimeMode将参数设置为Individual. - 设置
ExposureTimeSelector将参数设置为Stage1. - 设置
ExposureTime参数设置为所需的微秒级 Exposure Time。
注意: 您可以在以下位置找到相机模型的最小和最大 Exposure Time 值 详情 章节中 Exposure Time 主题。 - 对其他级重复步骤 b 和 c。
- 设置
-
指定 spatial correction stride 以确定 Spatial Correction 的起始行和方向:
设置BslSpatialCorrectionStride将参数设置为,例如 2。 - 设置 行组合模式 用于确定组合行的传感器像素值是相加还是取平均值:
设置BslLineCombinationMode参数设置为例如TDIAverage.
使用外部后处理程序组合行信息以生成高动态范围图像。
示例代码#
racer 2 XL 相机#
// Set the sensor acquisition mode to TDI Single Line
camera.BslSensorAcquisitionMode.SetValue(BslSensorAcquisitionMode_TDISingleLine);
// Set the sensor scan direction to Forward
camera.BslTDIScanDirection.SetValue(BslTDIScanDirection_Forward);
// Set the number of stages to 128
camera.BslTDINumberOfStages.SetValue(BslTDINumberOfStages_128);
INodeMap& nodemap = camera.GetNodeMap();
// Set the sensor acquisition mode to TDI Single Line
CEnumParameter(nodemap, "BslSensorAcquisitionMode").SetValue("TDISingleLine");
// Set the sensor scan direction to Forward
CEnumParameter(nodemap, "BslTDIScanDirection").SetValue("Forward");
// Set the number of stages to 128
CEnumParameter(nodemap, "BslTDINumberOfStages").SetValue("");
// Set the sensor acquisition mode to TDI Single Line
camera.Parameters[PLCamera.BslSensorAcquisitionMode].SetValue(PLCamera.BslSensorAcquisitionMode.TDISingleLine);
// Set the sensor scan direction to Forward
camera.Parameters[PLCamera.BslTDIScanDirection].SetValue(PLCamera.BslTDIScanDirection.Forward);
// Set the number of stages to 128
camera.Parameters[PLCamera.BslTDINumberOfStages].SetValue(PLCamera.BslTDINumberOfStages.);
/* 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 */
/* Set the sensor acquisition mode to TDI Single Line */
errRes = PylonDeviceFeatureFromString(hdev, "BslSensorAcquisitionMode", "TDISingleLine");
CHECK(errRes);
/* Set the sensor scan direction to Forward */
errRes = PylonDeviceFeatureFromString(hdev, "BslTDIScanDirection", "Forward");
CHECK(errRes);
/* Set the number of stages to 128 */
errRes = PylonDeviceFeatureFromString(hdev, "BslTDINumberOfStages", "");
CHECK(errRes);
racer 2 L Mono 相机#
// Set the sensor acquisition mode to Dual Line
camera.BslSensorAcquisitionMode.SetValue(BslSensorAcquisitionMode_DualLine);
// Set the exposure time for both lines (stages)
// Select stage 1
camera.ExposureTimeSelector.SetValue(ExposureTimeSelector_Stage1);
// Set the exposure time to 1000 microseconds
camera.ExposureTime.SetValue(1000.0);
// Select stage 2
camera.ExposureTimeSelector.SetValue(ExposureTimeSelector_Stage2);
// Set the exposure time to 1000000 microseconds
camera.ExposureTime.SetValue(1000000.0);
// Set the spatial correction stride to 2
camera.BslSpatialCorrectionStride.SetValue(BslSpatialCorrectionStride_2);
// Set the line combination mode to TDI Sum
camera.BslLineCombinationMode.SetValue(BslLineCombinationMode_TDISum);
INodeMap& nodemap = camera.GetNodeMap();
// Set the sensor acquisition mode to Dual Line
CEnumParameter(nodemap, "BslSensorAcquisitionMode").SetValue("DualLine");
// Set the exposure time for both lines (stages)
// Select stage 1
CEnumParameter(nodemap, "ExposureTimeSelector").SetValue("Stage1");
// Set the exposure time to 1000 microseconds
CFloatParameter(nodemap, "ExposureTime").SetValue(1000.0);
// Select stage 2
CEnumParameter(nodemap, "ExposureTimeSelector").SetValue("Stage2");
// Set the exposure time to 1000000 microseconds
CFloatParameter(nodemap, "ExposureTime").SetValue(1000000.0);
// Set the spatial correction stride to 2
CEnumParameter(nodemap, "BslSpatialCorrectionStride").SetValue("");
// Set the line combination mode to TDI Sum
CEnumParameter(nodemap, "BslLineCombinationMode").SetValue("TDISum");
// Set the sensor acquisition mode to Dual Line
camera.Parameters[PLCamera.BslSensorAcquisitionMode].SetValue(PLCamera.BslSensorAcquisitionMode.DualLine);
// Set the exposure time for both lines (stages)
// Select stage 1
camera.Parameters[PLCamera.ExposureTimeSelector].SetValue(PLCamera.ExposureTimeSelector.Stage1);
// Set the exposure time to 1000 microseconds
camera.Parameters[PLCamera.ExposureTime].SetValue(1000.0);
// Select stage 2
camera.Parameters[PLCamera.ExposureTimeSelector].SetValue(PLCamera.ExposureTimeSelector.Stage2);
// Set the exposure time to 1000000 microseconds
camera.Parameters[PLCamera.ExposureTime].SetValue(1000000.0);
// Set the spatial correction stride to 2
camera.Parameters[PLCamera.BslSpatialCorrectionStride].SetValue(PLCamera.BslSpatialCorrectionStride.);
// Set the line combination mode to TDI Sum
camera.Parameters[PLCamera.BslLineCombinationMode].SetValue(PLCamera.BslLineCombinationMode.TDISum);
/* 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 */
/* Set the sensor acquisition mode to Dual Line */
errRes = PylonDeviceFeatureFromString(hdev, "BslSensorAcquisitionMode", "DualLine");
CHECK(errRes);
/* Set the exposure time for both lines (stages) */
/* Select stage 1 */
errRes = PylonDeviceFeatureFromString(hdev, "ExposureTimeSelector", "Stage1");
CHECK(errRes);
/* Set the exposure time to 1000 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "ExposureTime", 1000.0);
CHECK(errRes);
/* Select stage 2 */
errRes = PylonDeviceFeatureFromString(hdev, "ExposureTimeSelector", "Stage2");
CHECK(errRes);
/* Set the exposure time to 1000000 microseconds */
errRes = PylonDeviceSetFloatFeature(hdev, "ExposureTime", 1000000.0);
CHECK(errRes);
/* Set the spatial correction stride to 2 */
errRes = PylonDeviceFeatureFromString(hdev, "BslSpatialCorrectionStride", "");
CHECK(errRes);
/* Set the line combination mode to TDI Sum */
errRes = PylonDeviceFeatureFromString(hdev, "BslLineCombinationMode", "TDISum");
CHECK(errRes);
# Set the sensor acquisition mode to Dual Line
camera.BslSensorAcquisitionMode.Value = "DualLine"
# Set the exposure time for both lines (stages)
# Select stage 1
camera.ExposureTimeSelector.Value = "Stage1"
# Set the exposure time to 1000 microseconds
camera.ExposureTime.Value = 1000.0
# Select stage 2
camera.ExposureTimeSelector.Value = "Stage2"
# Set the exposure time to 1000000 microseconds
camera.ExposureTime.Value = 1000000.0
# Set the spatial correction stride to 2
camera.BslSpatialCorrectionStride.Value = ""
# Set the line combination mode to TDI Sum
camera.BslLineCombinationMode.Value = "TDISum"
您也可以使用 pylon Viewer 轻松设置参数。