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,数据输入
Output Link O,数据输出

Supported 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

所有内核分量均使用相同的 const 值。

参数

值
键入 静态/动态读写参数
默认 0
范围 取决于输出链接的 Arithmetic 和 Bit Width

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

使用示例

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

  • 'Adaptive Threshold'

    局部自适应阈值二值化示例。 使用了 8×8 像素的 Kernel Size。

  • “Line Mirror”

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

  • 'Laser Triangulation'

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