Operator CONST

Operator Library: Base

CONST 算子在输出连接处提供一个固定值。 所有输入值都会被丢弃,并由该常数替代。 常数可以通过 Value 参数进行定义。 该值可以是静态值,也可以是动态值。 因此,该值可以在运行时进行更改。

请注意,对于 RGB 等多通道格式,常数值是针对整个像素定义为一个单一值, 而不是针对单个分量。

Example: Output link RGB 24bit, constant value is set to 11862494 (0xB501DE). The output components will then be set to the following const values: R = 222 (0xDE), G = 01 (0x01) and B = 181 (0xB5). The constant concatenates the component values to a single value. The component 0 is placed in LSB area and the highest component in MSB area, i.e. for RGB, the constant value is {B-G-R}. Value = {component N-1, ..., component 0}, with N being the number of the components.

I/O Property

Property 值
Operator Type O
Input Link I, data input
Output Link O,数据输出

支持的 Link Format

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

1

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

2

对于无符号 Arithmetic,输出范围为 [1, 63]。 对于有符号输出,范围为 [2, 64]。 对于无符号彩色输出,范围为 [3, 63];对于有符号彩色输出,范围为 [6, 63]。

3 4

所有 kernel 组件均使用相同的 const 值。

参数

值
键入 static/dynamic read/write parameter
默认 0
范围 取决于输出连接的 arithmetic 和 Bit Width

该参数定义输出连接处的值。 如果该参数设置为 Static,则在设计时选择该值。 如果该参数设置为 Dynamic,则可以在运行时更改该值。

使用示例

以下示例展示了 CONST 算子的用法:

  • 'Adaptive Threshold'

    局部自适应阈值的二值化示例。 使用了 8x8 像素的卷积核大小。

  • 'Line Mirror'

    示例 - 展示了如何垂直镜像图像。 请注意并行字和像素的镜像。

  • '激光三角测量'

    示例 - 一种 High Speed 且稳健的激光线检测算法。 该算法可确定重心坐标,以获得亚像素分辨率的结果。