From af8d1a1b43ec9831c7464f19ff0d06a5fbe5e7a5 Mon Sep 17 00:00:00 2001 From: wangchongwu <759291707@qq.com> Date: Sun, 24 Aug 2025 13:48:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=E8=BF=90=E5=8A=A8=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E7=A8=B3=E8=B7=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NeoTracker/src/Arith_TrackSAObj.cpp | 55 +++++++++++++------ NeoTracker/src/Common/Arith_AglPredict.cpp | 10 ++++ NeoTracker/src/Detect/Arith_DetectAreaObj.cpp | 2 +- NeoTracker/src/NeoArithStandardDll.h | 1 - NeoTracker/src/Version.h.in | 2 +- QGuideArithStudio/src/QVideoPlayer.cpp | 15 ++++- 6 files changed, 64 insertions(+), 21 deletions(-) diff --git a/NeoTracker/src/Arith_TrackSAObj.cpp b/NeoTracker/src/Arith_TrackSAObj.cpp index 43627f2..10c379b 100644 --- a/NeoTracker/src/Arith_TrackSAObj.cpp +++ b/NeoTracker/src/Arith_TrackSAObj.cpp @@ -1190,7 +1190,7 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI //局部变量 FLOAT32 fSim = 0.0f; //目标相似度 FLOAT32 fSimMax = -1.0f;//目标相似度最大值 - FLOAT32 fSimThres = 0.5f; //相似度阈值 + FLOAT32 fSimThres = 0.3f; //相似度阈值 SINT32 nFrmsStep = 1; //帧间隔 TARGET_OBJECT* ptMainTarget = NULL; //主管道目标 TARGET_OBJECT* ptTarget = NULL; //候选目标 @@ -1223,12 +1223,12 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI } - // 小目标主要使用位置信息 + // 小目标主要使用位置信息 //s3315运动不稳定,不优先使用运动模型 if (SizeType::SmallTarget == m_SizeMode) { - fMoveModelWeight = 0.7f; - fApparentModelWeight = 0.3f; - fMoveThres = 0.7f; + fMoveModelWeight = 0.5f; + fApparentModelWeight = 0.5f; + fMoveThres = 0.5f; } // +++++++++++++++++++++++++++++++++++++++++++++++++++++ //若长短轨迹预测异常,则直接取距离搜索区域中心最近的目标 @@ -1333,10 +1333,10 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI fSScaleChangeHighThres = 3.f; fAScaleChangeLowThres = 0.5; fAScaleChangeHighThres = 2.0; - nLastDiffThresX = MAX(nMoveMin, 6); - nLastDiffThresY = MAX(nMoveMin, 6); - nPredictDiffThresX = MAX(nFThreMin, 6); - nPredictDiffThresY = MAX(nFThreMin, 6); + nLastDiffThresX = MAX(nMoveMin, 12); + nLastDiffThresY = MAX(nMoveMin, 12); + nPredictDiffThresX = MAX(nFThreMin, 12); + nPredictDiffThresY = MAX(nFThreMin, 12); } else if (pPipe->unLostCnt < 20) { @@ -1391,11 +1391,19 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI fSScaleChangeHighThres = 3.f; fAScaleChangeLowThres = 0.5; fAScaleChangeHighThres = 2.0; - nLastDiffThresX = MAX(nMoveMin, 4); - nLastDiffThresY = MAX(nMoveMin, 4); - nPredictDiffThresX = MAX(nFThreMin, 6); - nPredictDiffThresY = MAX(nFThreMin, 6); + nLastDiffThresX = MAX(nMoveMin, 12); + nLastDiffThresY = MAX(nMoveMin, 12); + nPredictDiffThresX = MAX(nFThreMin, 12); + nPredictDiffThresY = MAX(nFThreMin, 12); } + //// 针对S3315大目标近距离伺服晃动,阈值强制放大 + //else if(pPipe->ObjectFilter.sfSize.w >= 6 || pPipe->ObjectFilter.sfSize.h >= 6 || pPipe->ObjectFilter.fPxlsCnt > 9) + //{ + // nLastDiffThresX = MAX(nLastDiffThresX, 36); + // nLastDiffThresY = MAX(nLastDiffThresY, 36); + // nPredictDiffThresX = MAX(nPredictDiffThresX, 36); + // nPredictDiffThresY = MAX(nPredictDiffThresY, 36); + //} SINT32 nEnd = pPipe->ubEnd; @@ -1428,6 +1436,8 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI } + + // 目标运动距离强逻辑:用预测位置和上一帧的位置,防止跟踪跳转到错误的目标 if (nSimTargetId != -1) { @@ -1465,6 +1475,19 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI fSimMax = -1; } } + + //// 灰度类型不同,任何情况都不允许跳跃 + //if (ptTarget->fSNR * ptMainTarget->fSNR < 0) + //{ + // if ((ABS(ptTarget->pfCenPos.x - stMotionMod_mean.crnObjPrediRtLong.cx) > MAX(ABS(fAzSpeed) * 2, 6) + // || ABS(ptTarget->pfCenPos.y - stMotionMod_mean.crnObjPrediRtLong.cy) > MAX(ABS(fPtSpeed) * 2, 6)) + // && (ABS(ptTarget->pfCenPos.x - m_ObjStatus.ptPos.x) > MAX(ABS(fAzSpeed) * 2, 6) + // || ABS(ptTarget->pfCenPos.y - m_ObjStatus.ptPos.y) > MAX(ABS(fPtSpeed) * 2, 6))) + // { + // fSimMax = -1; + // } + //} + } } ////+++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -1507,10 +1530,10 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI } // 警戒周边干扰时,调整阈值 - if (pPipe->blookout) + if (pPipe->blookout && pPipe->stMotionMod_mean.bTrackStable) { - fThres = 0.8 * ContiLostThres; - fMoveThres = 0.8 * 1.f - ContiLostThres; + fThres = fSimThres * ContiLostThres; + fMoveThres = fMoveThres * 1.f - ContiLostThres; } diff --git a/NeoTracker/src/Common/Arith_AglPredict.cpp b/NeoTracker/src/Common/Arith_AglPredict.cpp index 03ff8bd..a8c9614 100644 --- a/NeoTracker/src/Common/Arith_AglPredict.cpp +++ b/NeoTracker/src/Common/Arith_AglPredict.cpp @@ -207,6 +207,16 @@ void Predict_ObjAglTrackPredict(FilterMeanNL* pFilter, SINT32 nWidth, SINT32 nHe } pFilter->dnObjPredictDist = dnNLDist; + // 预测偏离,或者滤波器被重置时,均不能认为跟踪稳定 + if (dnNLDist.dx > 8 || dnNLDist.dy > 8 || (pFilter->ObjAglListsLong.nCnt == 0)) + { + pFilter->bTrackStable = false; + } + else + { + pFilter->bTrackStable = true; + } + ////利用长短时轨迹判断是否开启惯性预测,采用多帧判断 by wcw04046 @ 2022/01/17 //if (g_GLB_stOutput.nObjPredictFarCnt == 0) //{ diff --git a/NeoTracker/src/Detect/Arith_DetectAreaObj.cpp b/NeoTracker/src/Detect/Arith_DetectAreaObj.cpp index 638052a..b9c77c5 100644 --- a/NeoTracker/src/Detect/Arith_DetectAreaObj.cpp +++ b/NeoTracker/src/Detect/Arith_DetectAreaObj.cpp @@ -1825,7 +1825,7 @@ SINT32 DetectAreaObj::DAT_ObjsSegmentation(UINT16* pFrame, UBYTE8* pnGrayBinary, //MSSu, 20150514: 弱目标检测时,灰度、梯度二值点取并集,否则取交集 BBOOL bSeedPt = FALSE; if ((DAT_FLAG_BINARY == pnGrayBinary[nIndex] - || DAT_FLAG_BINARY == pnGradBinary[nIndex]) + && DAT_FLAG_BINARY == pnGradBinary[nIndex]) && DAT_FLAG_CONNECTED != pnFlagHasSr[nIndex]) { bSeedPt = TRUE; diff --git a/NeoTracker/src/NeoArithStandardDll.h b/NeoTracker/src/NeoArithStandardDll.h index 1934f8d..984fcda 100644 --- a/NeoTracker/src/NeoArithStandardDll.h +++ b/NeoTracker/src/NeoArithStandardDll.h @@ -76,7 +76,6 @@ typedef struct tagARIDLL_OBJINFO float fBgEntropy; //目标背景信息熵 float fSaliency; //目标显著性值 - // bool nJammingSucess; //目标成功干扰 diff --git a/NeoTracker/src/Version.h.in b/NeoTracker/src/Version.h.in index 92ad6d3..f8494b9 100644 --- a/NeoTracker/src/Version.h.in +++ b/NeoTracker/src/Version.h.in @@ -3,4 +3,4 @@ #pragma once #include std::string BUILD_TIME = "BUILD_TIME @build_time@"; -std::string VERSION = "BUILD_VERSION 1.4.0"; +std::string VERSION = "BUILD_VERSION 1.4.1"; diff --git a/QGuideArithStudio/src/QVideoPlayer.cpp b/QGuideArithStudio/src/QVideoPlayer.cpp index 2ae162e..c1c14fe 100644 --- a/QGuideArithStudio/src/QVideoPlayer.cpp +++ b/QGuideArithStudio/src/QVideoPlayer.cpp @@ -1924,10 +1924,21 @@ void QVideoPlayer::DrawPipeAglInfo() auto TrackListInfo = ARIDLL_GetTrackerHistInfo(pEOTracker, P); DrawAglList(m_ImageViewer, &TrackListInfo->ObjAglListsNear, QPen(QColor(255, 255, 255), 0.5, Qt::DotLine)); DrawAglList(m_ImageViewer, &TrackListInfo->ObjAglListsLong, QPen(QColor(255, 100, 100), 0.5, Qt::DotLine)); - QPen pen1(QPen(QColor(255, 255, 255), 0.5, Qt::SolidLine)); - DrawCrossInImage(m_ImageViewer, QRect(pPipe->stMotionMod_mean.crnObjPrediRtLong.cx - 40, pPipe->stMotionMod_mean.crnObjPrediRtLong.cy - 40, 80, 80), pen1); + + if (TrackListInfo->bTrackStable) + { + QPen pen1(QPen(QColor(255, 255, 255), 0.5, Qt::SolidLine)); + DrawCrossInImage(m_ImageViewer, QRect(pPipe->stMotionMod_mean.crnObjPrediRtLong.cx - 80, pPipe->stMotionMod_mean.crnObjPrediRtLong.cy - 80, 160, 160), pen1); + } + else + { + QPen pen2(QPen(QColor(255, 255, 255), 0.5, Qt::DotLine)); + DrawCrossInImage(m_ImageViewer, QRect(pPipe->stMotionMod_mean.crnObjPrediRtLong.cx - 40, pPipe->stMotionMod_mean.crnObjPrediRtLong.cy - 40, 80, 80), pen2); + } QPen pen2(QPen(QColor(255, 20, 20), 0.5, Qt::SolidLine)); DrawCrossInImage(m_ImageViewer, QRect(pPipe->stMotionMod_mean.crnObjPrediRtNear.cx - 25, pPipe->stMotionMod_mean.crnObjPrediRtNear.cy - 25, 50, 50), pen2); + + } else if(bEnableDrawFrameDetect) {