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,資料輸入
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

無符號算術的輸出範圍為 [1, 63]。 帶符號輸出的範圍為 [2, 64]。 無符號色彩輸出的範圍為 [3, 63],而帶符號色彩輸出的範圍則為 [6, 63]。

3 4

所有核心元件均使用相同的常量值。

Parameters

Value
Type static/dynamic 讀寫參數
Default 0
Range 這取決於算術運算以及輸出鏈路的位元寬度

此參數定義輸出鏈結上的值。 若將此參數設定為「靜態」,則該值將於設計階段選定。 若將此參數設定為「動態」,則可在執行階段變更該值。

Examples of Use

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

  • 「自適應閾值」

    局部自適應閾值法的二值化範例。 採用 8×8 像素的核大小。

  • 'Line Mirror'

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

  • 「雷射三角測量」

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