CB_Device SDK · 图像处理

版本 1.0 · 更新于 2026-10-21 · 阅读 0

基于查找表的 Gamma / 对比度亮度变换、坏点校正、中值滤波与锐化(仅支持 8bit 图像)。

CB_GammaLut

CB_RESULT CB_GammaLut(float fGamma, unsigned char ucLut[256])

根据Gamma值创建查找表

参数 方向 说明
fGamma in Gamma值
ucLut out 根据Gamma产生的查找表数组

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

说明

  • 产生查找表后调用CB_LutImage可以生成Gamma后的图像 Gamma功能只支持8bit图像

CB_ConstractBrightLut

CB_RESULT CB_ConstractBrightLut(float fConstract, int nBright, unsigned char ucLut[256], int nOffset = 128)

根据对比度、亮度创建查找表

参数 方向 说明
fConstract in 对比度倍率
nBright in 亮度
ucLut out 根据对比度、亮度产生的查找表数组
nOffset in 对比度中心偏移

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

说明

  • 产生查找表后调用CB_LutImage可以生成对比度、亮度变化后的图像 该功能只支持8bit图像

CB_LutImage

CB_RESULT CB_LutImage(CB_TFrameData* ptFrameIn, CB_TFrameData* ptFrameOut, unsigned char ucLut[256])

根据查找表处理图像

参数 方向 说明
ptFrameIn in 输入图像指针
ptFrameOut out 输出图像指针
ucLut in 查找表 该功能只支持8bit图像 输出图像的pBuffer内存要由用户分配,大小与输入图像一致

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_DefectivePixelCorrectSetEnable

CB_RESULT CB_DefectivePixelCorrectSetEnable(int32_t iDevIndex, bool bEnable)

使能坏点校正功能

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
bEnable in 是否使能坏点校正

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_DefectivePixelCorrectGetEnable

CB_RESULT CB_DefectivePixelCorrectGetEnable(int32_t iDevIndex, bool* pbEnable)

设备是否使能坏点校正功能

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
pbEnable out 获取设备是否使能坏点校正功能

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_MedianBlur

CB_RESULT CB_MedianBlur(CB_TFrameData* ptFrameIn, CB_TFrameData* ptFrameOut, int nKernelSize)

中值滤波

参数 方向 说明
ptFrameIn in 输入图像指针
ptFrameOut out 输出图像指针
nKernelSize in 滤波核大小。必须是比1大的奇数,例如:3,5,7… 输出图像的pBuffer内存要由用户分配,大小与输入图像一致

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_Sharpen

CB_RESULT CB_Sharpen(CB_TFrameData* ptFrameIn, CB_TFrameData* ptFrameOut, int nKernelSize, int nWeighted)

图像锐化

参数 方向 说明
ptFrameIn in 输入图像指针
ptFrameOut out 输出图像指针
nKernelSize in 图像锐化计算滤波核大小。必须是比1大的奇数,例如:3,5,7…
nWeighted in 图像锐化计算权重,1~99,值越大锐化越明显,建议值为80 输出图像的pBuffer内存要由用户分配,大小与输入图像一致

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)