Operator ColorTransform

Operator Library: Color

Operator ColorTransform 會將輸入端的 RGB 資料流轉換成具有加權元件的 RGB 資料流。 此轉換是透過與輸入 RGB 向量進行 3x3 矩陣相乘來執行。

轉換矩陣是由參數 Coefficients 所定義。 此參數是包含雙精確度係數的 3x3 矩陣。 以下公式表示轉換演算法。

計算會使用定點精確度值。 參數 Precision 和 Resolution 會指定乘法精確度。

  • Precision 定義用於編碼係數的位元數。

  • Resolution 定義係數的小數部分位元數。

例如,8 bit 的 precision 和 6 bits 的 resolution 將會產生介於以下範圍內的係數: .

如果輸入連結帶有正負號,或欄位參數 Coefficients 設定為 static,則允許將帶正負號的值用作係數。 當欄位參數 Coefficients 設定為 dynamic(即轉換係數可在執行階段變更)時,輸出連結一律帶有正負號。 其中一個 precision 位元會用作正負號位元。

提供矩陣相乘的結果。 這些結果會四捨五入至最接近的整數值。 輸出 Bit Width 是根據輸入 Bit Width 和參數設定自動決定。

[備註] 減少靜態參數所需的資源

如果參數 Coefficients 設定為 static,則 operator 需要較少的 FPGA 資源。

I/O Properties

Property Value
Operator Type O
Input Link I,影像資料輸入
Output Link O,影像資料輸入

支援的 Link 格式

Link Parameter Input Link I Output Link O
Bit Width [3, 54] unsigned, [6, 54] signed 自動1
Arithmetic {unsigned, signed} 自動
Parallelism any as I
Kernel Columns 1 as I
Kernel Rows 1 as I
Img Protocol {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} as I
Color Format VAF_COLOR as I
Color Flavor FL_RGB as I
Max. Img Width any as I
Max. Img Height any as I

1

輸出 Bit Width 是根據輸入 Bit Width 和參數設定自動決定。

參數

解析度
Type static parameter
Default 8
Range 自動

定義係數的小數部分位元數。 範圍取決於輸入 Bit Width 和 Precision 參數的值。請注意以下限制:

Resolution > 0

Precision > Resolution

Precision + Resolution <= 32

Precision
Type static parameter
Default 16
Range 自動

定義用於編碼整個係數的位元數 - 包含 resolution 位元和正負號位元。 範圍取決於輸入 Bit Width 和 Precision 參數的值。請注意以下限制:

Resolution > 0

Precision > Resolution

Precision + Resolution <= 32

Coefficients
Type dynamic/static read/write parameter
Default identity matrix
Range All Coefficients unsigned: Any Coefficient signed:

以單位轉換初始化的係數矩陣。 矩陣的所有係數皆由 operator 視為帶正負號的數字。這些係數為雙精度數。

使用範例

Operator ColorTransform 的使用方式如以下範例所示: