You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
4.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*********版权所有C2020武汉高德红外股份有限公司***************************************
* 文件名称: Arith_Detector.h
* 文件标识:
* 内容摘要: 检测器接口,根据项目情况实现,多个检测算法工作时注意检测结果的去重
* 其它说明: 外部尽量不要跨过 Arith_Detect模块对具体检测算法进行设置和调用保持良好封装性
* 当前版本:
* 创建作者04046WCW
* 创建日期2020/03/05
* 包含关系:
*****************************************************************************************/
#pragma once
#include "Arith_Common.hpp"
#include "API_DetectSAObj.h"
#include "Arith_ThreadPool.h" // 引入线程池头文件
// 定义检测器最大检测个数
//#define DT_TARGET_MAX_NUM 100
typedef struct
{
bool threadFlag;
std::mutex mutex;
bool DetFlag;
GD_VIDEO_FRAME_S img;
SINT32 nWidth;
SINT32 nHeight;
CENTERRECT mmCenterRect;
GLB_STATUS nStatus;
}det_thread_info;
// 检测器
class Detectors
{
public:
Detectors(GLB_INPUT* p_GLB_Input, SINT32 nWidth, SINT32 nHeight, CENTERRECT mmCenterRect);
Detectors(GLB_INPUT* p_GLB_Input, SINT32 nWidth, SINT32 nHeight);
virtual ~Detectors();
public:
// 检测器初始化
BBOOL GrayTypeInit(GLB_INPUT* p_GLB_Input);
// 执行目标检测算法
SINT32 Detect(GD_VIDEO_FRAME_S img, CENTERRECT mmCenterRect);
// 执行目标检测算法
SINT32 Detect(GD_VIDEO_FRAME_S img);
// 导入外部目标列表
SINT32 ImportExternTargets(TARGET_OBJECT* pTargetList, SINT32 nNum);
// 清除目标列表
void ClearTargetsArray();
// 检测器参数设置
void SetParam(Param_SkyDetect para);
// 返回参数设置
Param_SkyDetect GetParam();
// 获取目标检测队列
TARGET_OBJECT* GetTargetArray();
// 根据RECT剔除目标,标记false
void RemoveLabelTarget(RECT32S box);
// 输出小目标检测的极值点
POINT16S* GetDST_MaxPoint();
//// 面目标检测线程创建(指定调用者)
//void Arith_AreaDetThreadInit();
//// 小目标检测线程创建(指定调用者)
//void Arith_SmallDetThreadInit();
//// 面目标检测线程调用者
//void AreaDetThread();
//// 小目标检测线程调用者
//void SmallDetThread();
//// 面目标检测线程参数更新,循环调用仅需更新输入参数
//void Arith_SetAreaDetParam(GD_VIDEO_FRAME_S img, SINT32 nWidth, SINT32 nHeight, CENTERRECT mmCenterRect, GLB_STATUS nStatus);
//// 面目标检测线程参数更新,循环调用仅需更新输入参数
//void Arith_SetSmallDetParam(GD_VIDEO_FRAME_S img, SINT32 nWidth, SINT32 nHeight, CENTERRECT mmCenterRect, GLB_STATUS nStatus);
// 当前帧目标检测个数
SINT32 m_FrmObjsCnt;
//参数
public:
Param_SkyDetect mDetPara;
// 小目标检测算法
API_DetectSmallObj* pDST_Module;
// 面目标检测算法
API_DetectAreaObj* pDAT_Module;
//// 面目标检测算法析构标志
//BBOOL pDAT_Module_Free = FALSE;
//// 小目标检测算法析构标志
//BBOOL pDST_Module_Free = FALSE;
std::threadpool m_SA_TPool;
private:
GLB_STATUS nSysStatus;
// 目标检测队列
TARGET_OBJECT* m_Target_Array;
//// 面目标检测线程信息结构
//det_thread_info* g_pAreaDetHandle;
//// 小目标检测线程信息结构
//det_thread_info* g_pSmallDetHandle;
};
SINT16 MergeSmallAndAreaTarget(TARGET_OBJECT* ptTargetArray, SINT32 nSmallObjsCnt, SINT32 nAreaObjsCnt,SINT32 nCombineDist,GLB_STATUS nSysStatus);
void Sort_TargetArray(TARGET_OBJECT* ptTargetArray, SINT32 nObjsNum, FLOAT32 DetectCenterX, FLOAT32 DetectCenterY);
/*************************************
* Method: MergeAIAndSATarget()
* Function Description: 对现有检测数组中的目标进行合并
* CreateData: 2024/10/11
* Input Param: TARGET_OBJECT * ptTargetArray:需要合并的检测数组
* Input Param: SINT32 nObjsCnt:检测数组中的目标个数
* Output Param:
* Return: SINT32:合并后的目标个数
* Call Relation:
* Other Description:
*************************************/
SINT32 MergeAIAndSATarget(TARGET_OBJECT* ptTargetArray,SINT32 nTotalCnt);
/*************************************
* Method: DetSkyLineFilter()
* Function Description: 基于天地线标定信息的低空非识别目标过滤
* CreateData: 2025/3/13
* Input Param: TARGET_OBJECT * ptTargetArray:经过小面检测与AI融合的数组
* Input Param: SINT32 nObjsCnt:数组的个数
* Input Param: GLB_PARAMETERS * p_GLB_stPara
* Output Param:
* Return: SINT32:被抑制的小面目标个数
* Call Relation:
* Other Description:
*************************************/
SINT32 DetSkyLineFilter(TARGET_OBJECT* ptTargetArray, SINT32 nObjsCnt, GLB_PARAMETERS* p_GLB_stPara);