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 Properties

Property Value
Operator Type O
Input Link I, data input
Output Link O, data output

支援的 Link 格式

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

無號運算(unsigned arithmetic)的輸出範圍為 [1, 63]。 對於有號輸出(signed outputs),範圍為 [2, 64]。 對於無號色彩輸出,範圍為 [3, 63],而對於有號色彩輸出,範圍為 [6, 63]。

3 4

所有 Kernel 元件都使用相同的 const 值。

參數

Value
Type static/dynamic read/write parameter
Default 0
Range 取決於輸出連結的 Arithmetic 與 Bit Width

此參數定義輸出連結上的值。 如果參數設為 Static,則該值會在設計階段選定。 如果參數設為 Dynamic,則可以在執行階段變更該值。

使用範例

以下範例展示了 CONST 運算子的使用方式:

  • 'Adaptive Threshold'

    局部自適應閾值化的二值化範例。 使用 8x8 像素的 kernel 大小。

  • 'Line Mirror'

    範例 - 顯示如何對影像進行垂直鏡射。 請注意平行字組和像素的鏡射。

  • 「雷射三角測量」

    範例 - 一種 High Speed 且強固的雷射線偵測演算法。 此演算法可決定重心座標以取得亞像素解析度結果。