Files
CodeRepository/App_ThermalImageSystem/GeneralThermalImageSystem/CommSerialDef.h
chenzhen 222dda1e43 1,新增“App_ThermalImageSystem”;
2,新增“Apps”;
3,新增“Common”;
4,新增“FileList”;
5,新增“MediaX”;
6,新增“OpenSource”;
7,新增“Samples”;
8,新增“SoftwareBusinessLines”.
2026-02-14 23:03:23 +08:00

527 lines
14 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.
#ifndef _CommDef_H_
#define _CommDef_H_
#ifndef _byte_def_
#define _byte_def_
typedef unsigned char BYTE, Byte, byte;
#endif
#include <thread>
#include <chrono>
using namespace std;
#define DefaultImageWidth 1280
#define DefaultImageHeight 1024
#define DefaultMaxImageSize (1920*1080*4)
#define BUFF_SIZE 1040
#define MAX_UP_SIZE 20*1024*1024
#define MAX_FRAME_LENGTH 32768 // 每包最大128字节有效数据
#define MAX_QUALITY_PARAMS 100 //质量评估计算指标个数
typedef unsigned short UINT16;
////////////////////////////////////////////////////
#include <QString>
#include <QSerialPort>
enum EUFormatType
{
ETYPE_BIT = 0, //二进制
ETYPE_OX = 1, //带0x
ETYPE_UX = 2, //不带0x
};
enum EUConvertType
{
ECONVERT_OX = 0, //不带0x开头转换为0x开头的
ECONVERT_BIT = 1, //不带0x开头的转换成二进制前面加12个字节
};
//机芯版本
enum EUSetSystemType
{
SYSTEM_FPGA_ISP1 = 0, //老版本ISP
SYSTEM_FPGA_ISP2 = 1, //新版本ISP
SYSTEM_ASIC = 2, //ASIC机芯
SYSTEM_BUTT
};
// 像素类型
/*
* @class Settings
* @brief 串口参数设置
*
* @param name 串口名称
* @param baudRate 波特率
* @param stringBaudRate 波特率字符串
*/
struct ComSettings
{
QString name;
qint32 baudRate;
QString stringBaudRate;
QSerialPort::DataBits dataBits;
QString stringDataBits;
QSerialPort::Parity parity;
QString stringParity;
QSerialPort::StopBits stopBits;
QString stringStopBits;
};
/************************************************
**调光算法设置信息
************************************************/
typedef struct tagTG
{
int Y8MapIdx;
//去锅盖
bool DeGuoGaiArith;
bool GuoGaiModel;
//时域滤波
bool IsTimeFilter;
int TFSigma;
//竖纹
int DestripArithIdx;
int StripWeight;
int StripStd;
//去噪
int DenoiseArith;
int DenoiseStd;
//增强
int DDEArith;
int DDEParam;
int IDEArith;
//bool CalcNUC = false;
int FlagT;
//bool CalcSNR = false;
bool DeBadPixel;
bool Clahe;
unsigned short* GuogaiB;
tagTG()
{
Y8MapIdx = 0;
DeGuoGaiArith = false;
GuoGaiModel = false;
IsTimeFilter = false;
TFSigma = 10;
DestripArithIdx = 0;
StripWeight = 3700;
StripStd = 50;
DenoiseArith = 0;
DenoiseStd = 50;
DDEArith = 0;
DDEParam = 1;
IDEArith = 0;
FlagT = 0;
DeBadPixel = false;
Clahe = false;
GuogaiB = NULL;
}
}TG;
/************************************************
**机芯参数一键设置信息
************************************************/
typedef struct tagEngInfo{
ushort Fps; //帧频
ushort Width; //分辨率宽
ushort Height; //分辨率高
ushort SoftVerA; //软核版本号
ushort SoftVerX; //软核版本号
ushort SoftVerY; //软核版本号
ushort SoftYear; //软核版本年
ushort SoftMon; //软核版本月
ushort SoftDay; //软核版本日
ushort LogicVerA; //逻辑版本号
ushort LogicVerX; //逻辑版本号
ushort LogicVerY; //逻辑版本号
ulong SENIdNum; //机器识别码
tagEngInfo()
{
Fps = 50;
Width = 640;
Height = 512;
SoftVerA = 1;
SoftVerX = 0;
SoftVerY = 0;
SoftYear = 2021;
SoftMon = 12;
SoftDay = 25;
LogicVerA = 1;
LogicVerX = 0;
LogicVerY = 0;
SENIdNum = 0;
}
}EngInfo;
typedef struct tagSenInfo{
ushort AccWkTime; //设置工作时间
ushort SENIntMode; //积分模式
ushort SENUPCOL; //UPCOL
ushort SENUPROW; //UPROW
ushort OpenWindowSW; //开窗开关
ushort ADSHIFT; //AD延迟
ushort MultSampSw; //多倍采样开关
ushort AspectSw; //采样相位开关
ushort MultSampStPix; //输出起始点
ushort AspectValue; //相位值
ushort MultSampNum; //参与平均点数
ushort AdSeqType; //排列顺序
ushort AdValidSrc; //数据有效选择
tagSenInfo()
{
AccWkTime = 100;
SENIntMode = 0;
SENUPCOL = 1;
SENUPROW = 1;
OpenWindowSW = 0;
ADSHIFT = 12;
MultSampSw = 0;
AspectSw = 0;
MultSampStPix = 3;
AspectValue = 0;
MultSampNum = 1;
AdSeqType = 1;
AdValidSrc = 0;
}
}SenInfo;
typedef struct tagVCoreInfo{
ushort SyncMode; //同步模式
ushort IntTime[16]; //各档位积分时间
ushort ImgMode; //视频源模式
ushort LvdsVMode; //LVDS视频模式
ushort TestVMode; //测试画面
ushort TestVScope; //测试图像作用域
ushort Freeze; //图像冻结开关
ushort CharSw; //字符开关
ushort VideoSw; //模拟视频开关
tagVCoreInfo()
{
SyncMode = 0;
ImgMode = 0;
LvdsVMode = 1;
TestVMode = 1;
TestVScope = 2;
Freeze = 0;
CharSw = 1;
VideoSw = 1;
}
}VCoreInfo;
typedef struct tagXFilterInfo{
ushort XFilterMode; //时域滤波开关
ushort XFilterPar; //时域滤波强度
ushort Y8NoiseMode; //Y8去噪开关
ushort Y8NoiseThres; //Y8去噪参数
tagXFilterInfo()
{
XFilterMode = 1;
XFilterPar = 3;
Y8NoiseMode = 1;
Y8NoiseThres = 1;
}
}XFilterInfo;
typedef struct tagBpInfo{
ushort BPThres; //坏点阈值
ushort ReplaceMode; //坏点替换方式
ushort ReplaceSw; //坏点替换开关
ushort ReplaceType; //坏点替换开关
tagBpInfo()
{
BPThres = 25;
ReplaceMode = 0;
ReplaceSw = 1;
ReplaceType = 0;
}
}BpInfo;
typedef struct tagAutoBpInfo{
ushort AutoBPSw; //动态坏点开关
ushort BPLoopFrms; //坏点考察帧数
ushort NoiseH; //判断平坦阈值
ushort BPDiffTres; //平坦区域判断坏点阈值
tagAutoBpInfo()
{
AutoBPSw = 0;
BPLoopFrms = 8;
NoiseH = 200;
BPDiffTres = 20;
}
}AutoBpInfo;
typedef struct tagGGInfo{
ushort GGSw; //锅盖开关
tagGGInfo()
{
GGSw = 0;
}
}GGInfo;
typedef struct tagReStripeInfo{
ushort ReStripeSw; //去竖条开关
ushort ReStripeHoriSw; //去横纹开关
ushort RestripeWinSize; //窗口大小
ushort MoveThres; //运动检测阈值
ushort ReStripeSigmaIndex; //sigma值
ushort ReStripeThres; //Thres值
ushort ReStripeWeight; //权重
ushort ReStripeHoriThres; //横纹阈值
tagReStripeInfo()
{
ReStripeSw = 1;
ReStripeHoriSw = 1;
RestripeWinSize = 9;
MoveThres = 1;
ReStripeSigmaIndex = 70;
ReStripeThres = 15;
ReStripeWeight = 3700;
ReStripeHoriThres = 15;
}
}ReStripeInfo;
typedef struct tagNlMeansInfo{
ushort NlMeansSw; //空域开关
ushort NlMeansThres; //空域强度
ushort MoveCompensateSw; //运动补偿开关
tagNlMeansInfo()
{
NlMeansSw = 1;
NlMeansThres = 2;
MoveCompensateSw = 1;
}
}NlMeansInfo;
typedef struct tagDDEInfo{
ushort DDEDegree; //DDE强度
ushort DDESw; //DDE开关
ushort DDEY8Degree; //DDE强度
tagDDEInfo()
{
DDEDegree = 1;
DDESw = 1;
DDEY8Degree = 1;
}
}DDEInfo;
typedef struct tagIDEInfo{
ushort IDESw; //IDE开关
ushort IDESigmaIndex; //sigma值
ushort IDEPar; //强度
tagIDEInfo()
{
IDESw = 0;
IDESigmaIndex = 25;
IDEPar = 0;
}
}IDEInfo;
typedef struct tagBBHEInfo{
ushort LightMode; //调光模式
ushort LineBright; //Y8Range
ushort LineContrast; //Y8Mean
ushort Y8Range; //Y8Range
ushort Y8Mean; //Y8Mean
ushort LinePer; //LinePer
ushort HistPer; //HistPer
ushort TL; //TL
ushort TR; //TR
ushort Contrast; //Contrast
ushort Bright; //Bright
ushort ConLimit; //ConLimit
ushort RangeChangeSw; //RangeChange开关
ushort Y8ABCSw; //Y8_adjust开关
ushort Y16OutStream; //Y16数据流输出
ushort Y8OutStream; //Y8数据流输出
tagBBHEInfo()
{
LightMode =2;
Y8Range =230;
Y8Mean =40;
LinePer =1;
HistPer =1;
TL =300;
TR =100;
Contrast =50;
Bright =50;
ConLimit =6144;
RangeChangeSw =1;
Y8ABCSw =1;
LineBright = 50;
LineContrast = 50;
Y16OutStream = 1;
Y8OutStream = 1;
}
}BBHEInfo;
typedef struct tagCLAHEInfo{
ushort CLAHESw; //分块调光开关
ushort CLAHELimit; //分块调光参数
ushort CLAHEUseSw; //使用计算开关
tagCLAHEInfo()
{
CLAHESw = 0;
CLAHELimit = 410;
CLAHEUseSw = 0;
}
}CLAHEInfo;
typedef struct tagDehazeInfo{
ushort DehazeSw; //去雾开关
ushort DehazeSelect; //去雾表号
tagDehazeInfo()
{
DehazeSw = 0;
DehazeSelect = 1;
}
}DehazeInfo;
typedef struct tagPaletteInfo{
ushort HotSelect; //极性
ushort Psec; //伪彩
tagPaletteInfo()
{
HotSelect = 0;
Psec = 0;
}
}PaletteInfo;
typedef struct tagGeomTransInfo{
ushort MirrorMode; //镜像
ushort ZoomRatio; //无极放大
ushort Zoom; //电子放大
tagGeomTransInfo()
{
MirrorMode = 0;
ZoomRatio = 1000;
Zoom = 0;
}
}GeomTransInfo;
typedef struct tagCursorInfo{
ushort CursorType; //光标类型
ushort CursorX; //光标X坐标
ushort CursorY; //光标Y坐标
ushort CursorXCenter; //中心放大X坐标
ushort CursorYCenter; //中心放大Y坐标
tagCursorInfo()
{
CursorType = 0;
CursorX = 320;
CursorY = 256;
CursorXCenter = 320;
CursorYCenter = 256;
}
}CursorInfo;
typedef struct tagAutoFocusInfo{
ushort WinX; //自动聚焦窗X坐标
ushort WinY; //自动聚焦窗Y坐标
ushort WinLen; //自动聚焦窗宽
tagAutoFocusInfo()
{
WinX =320;
WinY =256;
WinLen =256;
}
}AutoFocusInfo;
typedef struct tagSoftStateInfo{
ushort AutoBaseMode; //本底档位模式
ushort AutoIntMode; //积分档位模式
ushort AutoBCMode; //亮度/对比度模式
ushort ADMax; //ADMax
ushort ADMin; //ADMin
ushort FovFlag1; //FovFlag1
ushort FovFlag2; //FovFlag1
ushort SceneType; //场景类型
tagSoftStateInfo()
{
AutoBaseMode = 0;
AutoIntMode = 1;
AutoBCMode = 0;
ADMax = 8000;
ADMin = 4000;
FovFlag1 = 1500;
FovFlag2 = 2500;
SceneType = 0;
}
}SoftStateInfo;
typedef struct tagAutoSetInfo{
EngInfo Eng;
SenInfo Sen;
VCoreInfo VCore;
XFilterInfo XFilter;
BpInfo Bp;
AutoBpInfo AutoBp;
GGInfo GG;
ReStripeInfo ReStripe;
NlMeansInfo NlMeans;
DDEInfo DDE;
IDEInfo IDE;
BBHEInfo BBHE;
CLAHEInfo CLAHE;
DehazeInfo Dehaze;
PaletteInfo Palette;
GeomTransInfo GeomTrans;
CursorInfo Cursor;
AutoFocusInfo AutoFocus;
SoftStateInfo SoftState;
}AutoSetInfo;
typedef struct tag_ImageAssessRect
{
UINT16 xpos; //像素起始X坐标
UINT16 ypos; //像素起始y坐标
UINT16 width; //像素宽度
UINT16 height; //像素高度
}ImageAssessRect;
typedef struct tag_ImageX16Mix
{
UINT16 nImageWidth; //图像宽度
UINT16 nImageHeight; //图像高度
int nHighTempre; //高温本底温度
int nLowTempre; //低温本底温度
}ImageX16Mix;
typedef struct tag_ImageY8BadPoint
{
UINT16 nImageWidth; //图像宽度
UINT16 nImageHeight; //图像高度
int nWinHalf; //检测半径
int nThresh; //检测阈值
int nPos; //无效区域位置
}ImageY8BadPoint;
typedef struct tagUpdataHead
{
int devid; //文件类型
int softNum; //文件编号
int majVer; //大版本
int subVer; //小版本
int year;
int month;
int day;
}UpdataHead;
#endif // _CommDef_H