Files
2026-02-01 22:23:06 +08:00

81 lines
1.8 KiB
C++
Raw Permalink 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.
#ifndef _HK_MAPPING_H_
#define _HK_MAPPING_H_
/***************************************************************************/
// hk 629调光模块
// 主要包括HK在629中压缩板调光
// 建立时间2024.10.31 gy
/**************************************************************************/
#include <stdlib.h>
#include <stdio.h>
//直方图统计的灰度总数
#define TOTAL_GRAYLEVEL (16384)
//UI用户调光可调参数界面输入参数
typedef struct tagMappingInputParam
{
//调光参数,界面可调
int nRightDiscard; // 右抛点百分比%
int nLeftDiscard; // 左抛点百分比%
float fContrast; // 新增变量界面上可修改默认为3.020250423
}MappingInputParam;
// 调光增强输出参数,界面不显示
typedef struct tagMappingOut
{
int Y16_Range; // Y16图像动态范围
int Y16_Max; // Y16图像抛点后的最大值
int Y16_Min; // Y16图像抛点后的最小值
int Y16_Mean; // Y16图像均值
}MappingOut;
//BBHE调光算法类
class __declspec(dllexport) HK_Mapping
{
public:
HK_Mapping(int nWidth, int nHeight);
~HK_Mapping();
void HKmappingParamInit(MappingInputParam *pstMappingPara, MappingOut *pstMappingOutPara);
void HK_LineMapping(unsigned short *pusSrc, unsigned char * pucDst, int nWidth, int nHeight, MappingOut &g_sMixMapOut);
// 新增调光固定对比度的线性调光20250423
void LineMappingKC(unsigned short* pusSrc, unsigned char* pucDst, int nWidth, int nHeight, MappingOut& g_sMixMapOut);
private:
void GetHistMaxMin(unsigned short *pSrc, int nWidth, int nHeight);
private:
//直方图统计得到的结果
int *m_pHist;
//当前场线性调光抛点最小值
int m_nMin;
//当前场线性调光抛点最大值
int m_nMax;
//当前场均值
int m_nY16Mean;
//抛点后Y16动态范
int m_nY16Range;
int m_nMapRange;
int m_nRightDiscard;
int m_nLeftDiscard;
int m_nStdThresh;
float m_fContrast;
};
#endif