Files
CodeRepository/Projects/App_DataCapturer/XCommon/include/ImgProcessDll.h

313 lines
15 KiB
C
Raw Normal View History

2026-02-01 22:23:06 +08:00
// 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\82
* 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);