Files
CodeRepository/Projects/App_DataCapturer/XCommon/include/ImgProcessDll.h
2026-02-01 22:23:06 +08:00

313 lines
15 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ImgProcessDll.h : 定义 DLL 应用程序的接口函数
//
typedef long int32;
typedef int BOOL;
typedef unsigned char BYTE;
typedef __int64 INT64 ;
#pragma once
/*================================== 图像前处理 =================================================================*/
/***************************************************************************
* ImgPreProcess()
* 功能描述若原始数据为有符号Y16则在调用算法前需先调用本函数进行数据转换
* 输入参数short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* 输出参数unsigned short* pDst 处理后的无符号数据
***************************************************************************/
extern "C" __declspec(dllexport) void ImgPreProcess(short* pSrc, unsigned short* pDst, int nWidth, int nHeight);
//原始数据先进行ImgDeMean操作
extern "C" __declspec(dllexport) void ImgDeMean(unsigned short* pSrc, unsigned short* pDst, int nWidth, int nHeight);
/*================================== Diaoguang =================================================================*/
// 混合调光输入参数
typedef struct tagMixMapPara
{
BOOL DetecterType; // 探测器类型 0:制冷; 1:非制冷
float RightDiscard; // 右抛点百分比%
float LeftDiscard; // 左抛点百分比%
BOOL MapMethod; // 映射方式 0:均值; 1:中值
int MixMedthod; // 混合方式 0:线性; 1:直方图; 2:混合
BOOL LastFrame; // 是否使用上一场参数 0:当前场; 1:上一场
int MapRange; // 映射范围
int PlatThres; // 平台直方图阈值
int nBright; //y16亮度调节
int nContrast; //y16对比度调节
int nContrastThresh;//对比度限制阈值
float fHighImgPara; //IDE自适应调节高频参数
int nClaheLimit; //CLAHE平台阈值
int nBFStd; //IDE 灰度滤波参数
BOOL bIsBBHE_Y8mean_adapt; //是否自适应调整Y8MEAN
int nClaheWinSize;
//BBHE参数
int nY8MapMean;
int nBBHELeft;
int nBBHERight;
tagMixMapPara()
{
//调光算法默认参数配置:
DetecterType = 0;
fHighImgPara = 0.0; //IDE自适应调节高频参数
LastFrame = 0; // 是否使用上一场参数 0:当前场; 1:上一场
LeftDiscard = 5; //1 // 左抛点百分比‰
MapMethod = 0; // 映射方式 0:均值; 1:中值
MapRange = 230; // 映射范围
MixMedthod = 2; // 混合方式 0:线性; 1:直方图; 2:混合
nBBHELeft = 300; // 2
nBBHERight = 100; // 3
nBFStd = 20; //IDE 灰度滤波参数
nBright = 50; //y16亮度调节
nClaheWinSize = 2;
nClaheLimit = 5; //CLAHE平台阈值
nContrast = 50; //y16对比度调节
nContrastThresh = 75; //对比度限制阈值
nY8MapMean = 40;
PlatThres = 200; // 平台直方图阈值
RightDiscard = 5; // 右抛点百分比‰
bIsBBHE_Y8mean_adapt = true; //是否自适应调整Y8MEAN
}
} MixMapPara;
// 混合调光输出参数
typedef struct tagMixMapOut
{
int Y16_Range; // Y16图像动态范围
int Y16_Max; //
int Y16_Min; //
int Y16_Mean; // Y16图像均值
int Y8_Mean; //Y8均值
// tagMixMapOut()
// {
// Y16_Range = 0;
// Y16_Max = 0; //
// Y16_Min = 0; //
// Y16_Mean = 0; // Y16图像均值
// Y8_Mean = 0;
// }
} MixMapOut;
/***************************************************************************
* MixTiaoGuangDll()
* 功能描述:混合调光算法:
* 输入参数:
unsigned short * pSrc : 输入16位图像
int nWidth: 图像宽
int nHeight: 图像高
* 输出参数:
unsigned char* pDst: 输出调光后8位图像
***************************************************************************/
extern "C" __declspec(dllexport) void MixTiaoGuangDll(unsigned short* pSrc, unsigned char* pDst, int nWidth, int nHeight, MixMapPara g_sMixMapPara, MixMapOut& g_sMixMapOut);
/***************************************************************************
* BBHE_MixTiaoGuangDll()
* 功能描述:混合调光算法:
* 输入参数:
unsigned short * pSrc : 输入16位图像
int nWidth: 图像宽
int nHeight: 图像高
* 输出参数:
unsigned char* pDst: 输出调光后8位图像
***************************************************************************/
extern "C" __declspec(dllexport) void BBHE_MixTiaoGuangDll(unsigned short* pSrc, unsigned char* pDst, int nWidth, int nHeight, MixMapPara g_sMixMapPara, MixMapOut& g_sMixMapOut);
/***************************************************************************
* ClaheMappingDll()
* 功能描述:分块调光
* 输入参数unsigned short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* bool bDataMode 数据位宽0Y161Y8
* int nWinSize 块数, 调节范围: 2\4\6\8默认2
* int nNormLimit 阈值, 调节范围1~20 默认5
* 输出参数unsigned char* const pDst 处理后的Y8图像
***************************************************************************/
extern "C" __declspec(dllexport) void ClaheMappingDll(unsigned short* pSrc, unsigned char* const pDst,
int nWidth, int nHeight, bool bDataMode,
int nWinSize, int nNormLimit, MixMapPara g_sMixMapPara);
/*================================== IDE =================================================================*/
/***************************************************************************
* IDE_MSR_BFDll()
* 功能描述IDE
* 输入参数unsigned short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int nPosFilterWin 5x5
* 输出参数unsigned char* pDst 处理后的Y8图像
***************************************************************************/
extern "C" __declspec(dllexport) void IDE_MSR_BFDll(unsigned short* pSrc, unsigned char* pDst, int nWidth, int nHeight, int nPosFilterWin, MixMapPara& g_sMixMapPara, MixMapOut& g_sMixMapOut);
/*================================== DDE =================================================================*/
/***************************************************************************
* LaplaceSharpenDll()
* 功能描述DDE
* 输入参数unsigned short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int nFilterHalfW 1
* int nFilterHalfH 1
* int gDdeStep 2 增强系数
* 输出参数unsigned short *pSrc 处理后的图像
***************************************************************************/
extern "C" __declspec(dllexport) void LaplaceSharpenDll(unsigned short* pSrc, int nWidth, int nHeight, int nFilterHalfW, int nFilterHalfH, int gDdeStep);
/***************************************************************************
* NlMeansDll()
* 功能描述:去噪
* 输入参数unsigned short *pSrc16 16位无符号数据
* unsigned char* pSrc8 8位无符号数据
* unsigned char bitWitdth 16/8
* int nWidth 图像宽度
* int nHeight 图像高度
* int nSWBlocX 7
* int nSWBlocY 3
* int nPWBloc 1
* int nSigma 20
* 输出参数unsigned short *pusSrcImg 处理后的图像
***************************************************************************/
extern "C" __declspec(dllexport) void NlMeansDll(unsigned char bitWitdth, unsigned short* pSrc16, unsigned char* pSrc8,
int nWidth, int nHeight, int nSWBlocX, int nSWBlocY, int nPWBloc, int nSigma);
/*================================== 去竖条纹 =================================================================*/
/***************************************************************************
* RemoveVecStripeNoise()
* 功能描述:原去竖条纹
* 输入参数unsigned short *pusSrcImg 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int nVecStripeStd 50
* int nVecStripeWin 9
* int nVecStripeWeightThres 3700
* int nVecStripeValueThres 15
* 输出参数unsigned short *pusSrcImg 处理后的图像
***************************************************************************/
extern "C" __declspec(dllexport) void RemoveVecStripeNoise(unsigned short* pusSrcImg, int nWidth, int nHeight,
int nVecStripeStd, int nVecStripeWin, int nVecStripeWeightThres, int nVecStripeValueThres);
/***************************************************************************
* RemoveVecStripeNoiseByFourPart()
* 功能描述4去竖条纹
* 输入参数unsigned short *pusSrcImg 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int nVecStripeStd 50
* int nVecStripeWin 9
* int nVecStripeWeightThres 3700
* int nVecStripeValueThres 15
* 输出参数unsigned short *pusSrcImg 处理后的图像
***************************************************************************/
extern "C" __declspec(dllexport) void RemoveVecStripeNoiseByFourPart(unsigned short* pusSrcImg, int nWidth, int nHeight,
int nVecStripeStd, int nVecStripeWin, int nVecStripeWeightThres, int nVecStripeValueThres);
/*================================== 去横纹 =================================================================*/
/***************************************************************************
* RemoveHorStripeNoise()
* 功能描述:去横纹
* 输入参数unsigned short *pusSrcImg 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int nVecStripeStd 50
* int nVecStripeWin 9
* int nVecStripeWeightThres 3700
* int nVecStripeValueThres 15
* 输出参数unsigned short *pusSrcImg 处理后的图像
***************************************************************************/
extern "C" __declspec(dllexport) void RemoveHorStripeNoise(unsigned short* pusSrcImg, int nWidth, int nHeight,
int nVecStripeStd, int nVecStripeWin, int nVecStripeWeightThres, int nVecStripeValueThres);
/*================================== 时域滤波 =================================================================*/
/***************************************************************************
* TimeNoiseFliterDll()
* 功能描述:时域滤波
* 输入参数unsigned short *pusSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int nSigma 10
* int nPower 5
* 输出参数unsigned short *pusSrc 处理后的图像
***************************************************************************/
extern "C" __declspec(dllexport) void TimeNoiseFliterDll(unsigned short* pusSrc, int nWidth, int nHeight, int nSigma, int nPower);
/*================================== 去坏点 =================================================================*/
/***************************************************************************
* BadPixelDeTect()
* 功能描述:静态去坏点,处理均匀面
* 输入参数unsigned short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int g_nAutoBadPixelKernel 5
* int g_badpixelThreshold 15
* 输出参数int &g_badpixleNumSingle 坏点数
***************************************************************************/
extern "C" __declspec(dllexport) void BadPixelDeTect(unsigned short* pSrc, unsigned char* pDst, int nWidth, int nHeight, int g_nAutoBadPixelKernel, int g_badpixelThreshold, int& g_badpixleNumSingle);
/***************************************************************************
* BadPixelDeTect()
* 功能描述:运动去坏点,运动场景
* 输入参数unsigned short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* int g_nAutoBadPixelKernel 5
* int g_badpixelThreshold 15
* 输出参数int &g_badpixleNumSingle 坏点数
***************************************************************************/
extern "C" __declspec(dllexport) void BtmRemoveBadPixel(unsigned short* pSrc, int nWidth, int nHeight, int g_nAutoBadPixelKernel, int g_badpixelThreshold, int& g_badpixleNumMove);
/*================================== 去锅盖 =================================================================*/
/***************************************************************************
* DeGuoGai()
* 功能描述:去锅盖
* 输入参数unsigned short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* BOOL g_bGuoGaiModel true
* unsigned short *pModelImg model image
* 输出参数unsigned short *pSrc 去锅盖数据
***************************************************************************/
extern "C" __declspec(dllexport) void DeGuoGai(unsigned short* pSrc, int nWidth, int nHeight, BOOL g_bGuoGaiModel, unsigned short* pModelImg);
/*================================== 图像缩放 =================================================================*/
/***************************************************************************
* bilinearResizeY16()
* 功能描述Y16图像缩放
* 输入参数unsigned short *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* float g_fZoomWidth 1.0
* float g_fZoomHeight 1.0
* 输出参数unsigned short *pSrc 图像缩放
***************************************************************************/
extern "C" __declspec(dllexport) void bilinearResizeY16(unsigned short* pSrc, int iWidth, int iHeight, float g_fZoomWidth, float g_fZoomHeight);
/***************************************************************************
* bilinearResizeY8()
* 功能描述Y8图像缩放
* 输入参数unsigned char *pSrc 16位无符号数据
* int nWidth 图像宽度
* int nHeight 图像高度
* float g_fZoomWidth 1.0
* float g_fZoomHeight 1.0
* 输出参数unsigned char *pSrc 图像缩放
***************************************************************************/
extern "C" __declspec(dllexport) void bilinearResizeY8(unsigned char* pSrc, int iWidth, int iHeight, float g_fZoomWidth, float g_fZoomHeight);