Operator Library: Base
运算符 ConvertPixelFormat 尝试在将 Arithmetic 和 Bit Width 调整为所需的目标 Pixel Format 的同时,尽可能保留最多的信息。 因此,该运算符允许在输出链路(output link)上定义 Bit Width 和 Arithmetic。
该算法的基本原理包含两个方面:
-
通过截断更改 Arithmetic
- 无符号转有符号:使用输出端的 MSB 作为符号位
- 有符号转无符号:截断为正值,即如果值小于 0,则设为零
-
通过保持相对亮度来更改 Bit Width
- 如果输出 Bit Width 增加,则将值左移以满足所需的 Bit Width
- 如果输出 Bit Width 减少,则将值除以相应数值并四舍五入以满足所需的 Bit Width
因此,输出值可以确定为:
| Input Bit Width | Output Bit Width | 输入 Arithmetic | 输出 Arithmetic | 输入值 | 输出值 | 注释 | ||
|---|---|---|---|---|---|---|---|---|
| 十进制 | 二进制 | 十进制 | 二进制 | |||||
| 4 | 5 | unsigned | unsigned | 10 | 1010 | 20 | 10100 | value * 2 |
| 5 | 4 | unsigned | unsigned | 15 | 1111 | 8 | 1000 | value 除以 2 并四舍五入 |
| 5 | 4 | unsigned | unsigned | 31 | 11111 | 15 | 1111 | value 截断至最大值 |
| 4 | 4 | unsigned | signed | 11 | 1011 | 6 | 0100 | value 除以 2 并四舍五入 |
| 4 | 4 | signed | unsigned | 4 | 0100 | 8 | 1000 | value * 2 |
| 5 | 4 | signed | unsigned | 10 | 01010 | 10 | 1010 | 保持 value |
| 5 | 4 | signed | unsigned | -2 | 11110 | 0 | 0000 | value 截断至 0 |
| 5 | 4 | signed | signed | -7 | 11001 | -4 | 1100 | value 除以 2 并四舍五入 |
表 34. 示例
对于彩色链路,每个颜色分量均单独进行处理。
以下示例展示了运算符 ConvertPixelFormat 的使用方法:
-
图 204,“针对 16Bit 输出添加的 ConvertPixelFormat 运算符”
基本指南 - 使用 ConvertPiyelFormat 更改 DMA Bit Width。
-
示例 - 该示例展示了使用 3x3 滤波器对 Bayer RAW 图案进行去马赛克处理。
-
示例 - 该示例展示了使用 5x5 滤波器对 Bayer RAW 图案进行去马赛克处理。
-
“Bayer 3x3 Demosacing with White Balancing”
示例 - 该示例展示了使用 3x3 滤波器对 Bayer RAW 图案进行去马赛克(Demosaicing)处理。 此外,还添加了用于颜色校正的白平衡。
-
示例 - 该示例展示了使用 5x5 滤波器对 Bayer RAW 图案进行去马赛克处理。 此外,还添加了用于色彩校正的白平衡功能。
-
“针对色彩图案为 Red/BlueFollowedByGreen GreenFollowedByBlue/Red 的双线阵相机的 Bayer 去马赛克”
示例 - 该示例展示了对具有色彩图案 Red/BlueFollowedByGreen_GreenFollowedByBlue/Red 的双线阵相机的 Bayer RAW 图案进行去马赛克处理
-
'适用于具有 RedFollowedByBlue GreenFollowedByGreen 彩色模式的双线阵彩色相机的 Bayer Demosaicing'
示例 - 该示例展示了双线阵彩色相机 Bayer RAW 模式的去马赛克处理,其彩色模式为 Red/BlueFollowedByBlue/Red_GreenFollowedByGreen
-
'具有 8 位 BiColor Bayer 模式的线阵相机的 Bayer Demosaicing'
示例 - 本示例展示了带有 BiColor Bayer 模式的 CXP-12 线阵相机(例如 racer 2 L 相机)的 Bayer 8 位 RAW 模式去马赛克处理: BiColorRGBG、BiColorGRGB、BiColorBGRG 和 BiColorGBGR。此外,该示例还包含 一个线阵触发模块 和一个白平衡模块。
-
'具有 10 位 BiColor Bayer 模式的线阵相机的 Bayer Demosaicing'
示例 - 本示例展示了带有 BiColor Bayer 模式的 CXP-12 线阵相机(例如 racer 2 L 相机)的 10 位 Bayer RAW 模式去马赛克处理: BiColorRGBG、BiColorGRGB、BiColorBGRG 和 BiColorGBGR。此外,该示例还包含 一个线阵触发模块 和一个白平衡模块。
-
'具有 12 位 BiColor Bayer 模式的线阵相机的 Bayer Demosaicing'
示例 - 本示例展示了带有 BiColor Bayer 模式的 CXP-12 线阵相机(例如 racer 2 L 相机)的 10 位 Bayer RAW 模式去马赛克处理: BiColorRGBG、BiColorGRGB、BiColorBGRG 和 BiColorGBGR。此外,该示例还包含 一个线阵触发模块 和一个白平衡模块。
-
示例 - 展示了 imaFlex 平台的协处理器功能。以计算大滤波器内核为例。
-
示例 - 该示例展示了图像帧开始和结束时的信号与事件生成。
-
示例 - 展示如何拆分和合并图像流。向图像附加尾部。
-
示例 - 该示例展示了 2D Shading Correction 的实现。 校正值存储在采集卡 RAM 中。 该小应用程序执行高精度偏移和增益校正。
-
'1D Shading Correction Using Block RAM'
Examples - 该示例展示了一维 Shading Correction。 校正值存储在块 RAM 内存中。
-
'使用采集卡 RAM 的 1D Shading Correction'
示例 - 该示例展示了 1D Shading Correction。 校正值存储在采集卡 RAM 中。
-
'imaFlex CXP-12 Quad Platform 上的 DMAFromPC 算子示例'
示例 - 以 Shading Correction 为例演示算子的使用方法



上一页

