Operator Library: Base
透過選擇輸入的低位元,CastBitWidth 運算子可以改變 Bit Width。若輸出的 Bit Width大於輸入的 Bit Width,數值將保持不變,也就是在最高有效位元 (most significant bits) 新增位元。有號數 (signed value) 會進行符號擴展 (sign extension)。若輸出的 Bit Width小於輸入的 Bit Width,則會捨棄最高有效位元。數值將變更為
,亦即僅使用剩餘的位元。輸出的 Bit Width由
.
對於色彩數值,每個元件皆會個別進行處理。
![]() |
CastBitWidth 運算子可能會破壞您的數值 |
|---|---|
|
唯有在確定不需要這些位元時,才將其捨棄。CastBitWidth 運算子可能會破壞您的數值。 |
| Input Bit Width | Input Value | Arithmetic | Output Bit Width | 輸出值 | Comment | ||
|---|---|---|---|---|---|---|---|
| Decimal | Binary | Decimal | Binary | ||||
| 5 | 10 | 01010 | unsigned | 4 | 10 | 1010 | 數值保持不變 |
| 5 | 10 | 01010 | unsigned | 3 | 2 | 010 | 數值已變更 |
| 5 | 10 | 01010 | signed | 6 | 10 | 001010 | 數值保持不變 |
| 5 | -10 | 10110 | signed | 6 | -10 | 110110 | 數值保持不變,進行符號擴展 |
| 5 | 10 | 01010 | signed | 4 | -6 | 1010 | 數值已變更 |
| 5 | -10 | 10110 | signed | 4 | 6 | 0110 | 數值已變更 |
表 31. 範例
以下範例顯示了 CastBitWidth 運算子的使用方式:
-
圖 205,「已新增 ShiftLeft Operator 用於 16Bit 輸出」
基本指南 - User ShiftLeft 以變更 DMA Bit Width。
-
'Combine Image Data From Two Camera Sources - Building an Overlay Blend'
Example - From equation to implementation. Explanation on how to implement the overlay blend.
-
範例 - 柱狀圖閾值處理
-
範例 - 顯示 operator Blob_Analysis_2D 的用法。 此 applet 會將輸入資料進行二值化並判定 Blob 分析結果。 結果以及原始影像會透過兩個 DMA 通道輸出。
-
範例 - 將 blob 分析運算子套用至輸入相機影像。 此 applet 顯示了 applet 中 blob 資料的使用方式。 在此情況下,會定位出具有最大面積的物件,並使用其座標從原始影像中裁切出該物件。
-
Examples - The applet shows an example for white balancing on RGB images.
-
範例 - Kirsch Filter 是一種適用於無方向性邊緣的良好邊緣偵測濾鏡。
-
範例 - 僅在 X 方向上的 Sobel 濾鏡。
-
範例 - 涵蓋所有 4 個方向的 Sobel 濾鏡。
-
範例 - 一個簡單的 3x3 方框濾鏡。
-
範例 - 使用 5x5 核心的高斯濾鏡。
-
範例 - 平行使用兩個濾波器的範例。
-
範例 - 未使用 SampleDn 運算子進行 3x3 因數下取樣。
-
範例 - 顯示如何對影像進行垂直鏡射。 請注意平行字組和像素的鏡射。
-
「High Dynamic Range and Low Dynamic Range Example Using Camera Response Function」
範例 - 根據 Debevec 的 High Dynamic Range
-
'High Dynamic Range and Low Dynamic Range Example with a Weighted Linear Ansatz'
範例 - 採用 Linear Ansatz 的 High Dynamic Range
-
範例 - 一種 High Speed 且強固的雷射線偵測演算法。 此演算法可決定重心座標以取得亞像素解析度結果。
-
範例 - 此範例展示了 2D Shading Correction 的實作。 校正值會儲存在畫面擷取卡 RAM 中。 該 Applet 會執行高精度的偏移與增益校正。
-
'使用 RamLUT Operator 進行 2D Shading Correction / 平場校正'
範例 - 此範例顯示了 2D Shading Correction 的實作。 校正值儲存在 operator RamLUT 中。 此 applet 執行高精確度的位移和增益校正。
-
「使用 Block RAM 的 1D Shading Correction」
範例 - 此範例展示了 1D Shading Correction。 校正值會儲存在 block RAM memory 中。
-
'1D Shading Correction Using Frame Grabber RAM'
範例 - 此範例展示了 1D Shading Correction。 校正值會儲存在畫面擷取卡 RAM 中。

![[備註]](../common/images/admon/note.png)


上一頁

