ImageBuffer 算子

Operator Library: Memory

该算子在 Frame Grabber RAM (DRAM) 中对图像流进行缓冲。 需要一个类型为 RAM 的 VisualApplets 资源。请查看 'Allocation of Device Resources' 了解更多信息。 该算子还支持感兴趣区 (ROI)。 总比特数(Bit Width 乘以 Parallelism)不得超过相应图像采集卡的 Memory 限制。

For information on the latency of the operator, see Table 46, 'Individual Latencies of the Operators in Library Memory'.

该算子的工作原理类似于 FIFO。 所有输入数据都会立即转发到输出端。 然而,如果输出被阻塞(例如,由于后续算子无法处理输入带宽),算子将存储该数据。 因此,只有在算子无法输出数据时,才会 Fill Memory。 通常,该算子用于补偿峰值输入带宽。

Internally, the image buffer operates on image lines. This internal line buffer feature results in a very short memory latency. Of course, latency increases if the buffer is filled with more lines. For example, images which are transfered into the memory will be immediately forwarded to the output. In an application, partial camera images can be forwarded to the PC while the camera still transfers the remaining image lines.

使用参数 XOffset、XLength、 YOffset 和 YLength,您可以定义 ROI 大小。 如果输入图像宽度小于 XOffset 和 XLength 的总和,算子仍将读取参数化后的 XLength。 在这种情况下,算子将为额外的像素输出未定义的 Memory 内容。 如果输入图像高度小于请求的输出图像高度,算子将只输出可用的行。

In Line1D application mode, the YOffset and YLength settings do not affect the buffer.

为了测量缓冲区的 Fill 级别,该算子提供 2 个参数: FillLevel 和 Overflow。 FillLevel 以 25% 的步长显示 RAM 的 Fill 级别。 当 FillLevel 接近或等于 100% 并且下一个要存储在缓冲区中的图像将超出 RAM 容量时,Overflow 参数设置为 1。 如果发生溢出,将丢弃输入数据并减小输入图像高度。 因此,不完整的图像会存储在 Memory 中。 用户必须轮询 Overflow 参数。 由于溢出状态持续时间可能非常短,因此它可能会在算子的轮询周期内发生。

参数 InfiniteSource 用于指定算子是直接连接到相机还是与其他 Memory 算子串联。 请查看 'Infinite Sources / Connecting Cameras' 了解更多信息。

算子限制

  • 不支持空帧。

[注意] 可用内存空间

该算子需要额外的 Memory 空间来存储内部数据。因此,并非所用 RAM 资源的全部容量都可以用于缓冲图像数据。 实际可用于缓冲图像数据的空间取决于硬件平台(Platform RAM Size 和 Platform RAM Interface Width)以及链路配置。 有关 Platform RAM Size 和 Platform RAM Interface Width 的信息,请参见 Device Resources。)

您可以使用以下公式计算 RAM 资源的可用容量:

  • Utilized RAM Size [in Bytes] = ((PRS * 2^20 / (PRIW / 8 bit)) / RLS) * MIW * BW / 8

  • Utilized RAM Size [in Lines] = ((PRS * 2^20 / (PRIW / 8 bit)) / RLS)

  • Utilized RAM Size [in Frames] = ((PRS * 2^20 / (PRIW / 8 bit)) / RLS) / MIH

公式中使用的缩写和计量单位:

  • PRS: Platform RAM Size [in MB, 1MB = 2^20 Byte]

  • PRIW: Platform RAM Interface Width [in bit]

  • MIW: MaxImageWidth [in pixel]

  • MIH: MaxIMageHeight [in lines]

  • P: Parallelism

  • BW: Bit Width [in bit]

  • RLS: Raw Line Size: 2 ^ ceil(log2n(MIW / P + 4))

带宽优化

通过使用 Frame Grabber RAM (DRAM) 的算子的理论带宽 [bits/second] 根据以下公式计算:

然而,由于 DRAM 效率,实际带宽总是小于理论带宽。

如果 Bit Width 和 Parallelism 的乘积等于内部 RAM Port Width,则达到穿过算子的 maximum bandwidth。

[注意] 平台特定值

RAM Port Width 和系统时钟是平台特定的。有关您各个平台的详细信息,请参阅 Device Resources。

I/O Property

Property 值
Operator Type M
Input Link I,图像数据输入
Output Link O,数据输入

支持的 Link Format

Link Parameter Input Link I Output Link O
Bit Width [1, 64]12 as I
Arithmetic {unsigned, signed} as I
Parallelism any3 as I
Kernel Columns 1 as I
Kernel Rows 1 as I
Img Protocol {VALT_IMAGE2D, VALT_LINE1D} as I
Color Format any as I
Color Flavor any as I
Max. Img Width 65535 as I
Max. Img Height 65535 as I

1

对于无符号输入,输入 Bit Width 的范围是 [1, 64]。 对于有符号输入,范围是 [2, 64]。 对于无符号彩色输入,范围是 [3, 63],对于有符号彩色输入,范围是 [6, 63]。

2 3

Bit Width 与 Parallelism 的乘积不得超过本机 RAM 数据宽度。 请查看 Device Resources 了解更多信息。

参数

XOffset
键入 动态/静态读/写参数
默认 0
范围 [0, Max.Img Width - XLength]

此参数定义 ROI 左上角的 x 坐标。

步长即为 Parallelism。

XLength
键入 动态/静态读/写参数
默认 1024
范围 [2*Parallelism, Max.Img Width - XOffset]

此参数定义 ROI 的宽度。

步长即为 Parallelism。

YOffset
键入 动态/静态读/写参数
默认 0
范围 [0, Max.Img Height - YLength]

This parameter defines the y-coordinate of the upper left corner of the ROI.

YLength
键入 动态/静态读/写参数
默认 1024
范围 [1, Max.Img Height - YOffset]

此参数定义 ROI 的高度。

FillLevel
键入 动态读取参数
默认 0
范围 [0%, 100%]

此参数以 25% 的步长提供 DRAM 的 Fill 水平。

Overflow
键入 动态读取参数
默认 0
范围 [0, 1]

此参数指示缓冲区溢出。

InfiniteSource
键入 静态参数
默认 已启用
范围 {ENABLED, DISABLED}

此参数激活对诸如相机算子等无限源算子的支持。 有关详细信息,请参阅 “Infinite Sources / Connecting Cameras”。

使用示例

以下示例展示了 ImageBuffer 算子的使用: