V1.4.2 20250825晚上提交版本

main
wangchongwu 6 months ago
parent af8d1a1b43
commit 04dd7d3816

@ -235,7 +235,6 @@ SINT32 Detectors::Detect(GD_VIDEO_FRAME_S img)
}
POINT16S* Detectors::GetDST_MaxPoint()
{
return pDST_Module->getMaxPoint();

@ -510,6 +510,10 @@ void SA_Tracker::SetAutoSearchZone(SINT32 nWidth, SINT32 nHeight, GLB_INPUT* p_G
snPipeRadius.h = MAX((SINT32)(fObjVy * 2), nPipeRadiusTrack);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
//根据管道半径,修正分块大小:
//保证nBlkNumW<=20, nBlkNumH<=16防止分块极值点坐标溢出及保证计算量
@ -694,6 +698,13 @@ void SA_Tracker::SARegionDet(GD_VIDEO_FRAME_S img, GLB_INPUT* p_GLB_Input, SINT3
// 面目标跟踪模式
if (m_SizeMode == SizeType::AreaTarget)
{
// 针对S3315近处大目标伺服不收敛优化
if (!stMotionMod_mean.bTrackStable && (trackTarget->snSize.w > 8 || m_LockingPipe->ObjectFilter.fPxlsCnt > 10))
{
m_TSA_Input.crCenterRect.w = MAX(m_TSA_Input.crCenterRect.w, 256);
m_TSA_Input.crCenterRect.h = MAX(m_TSA_Input.crCenterRect.w, 256);
}
SINT32 nAreaTargetNum = pDAT_Module->Detect(img, m_TSA_Input.crCenterRect, nObjCombineDist, GLB_STATUS_TRACK);
m_TSA_output.crCenterRect = pDAT_Module->getDAT_stOutput()->crCenterRect;
m_TSky_Output->mTrakingPara_Output.nAreaCombineDist = nObjCombineDist; // 面目标合并距离调试输出
@ -1397,13 +1408,13 @@ SINT32 SA_Tracker::FindMatchTarget(PIPE* pPipe, TARGET_OBJECT* ptTargetArray, SI
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);
//}
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, 100);
nPredictDiffThresY = MAX(nPredictDiffThresY, 100);
}
SINT32 nEnd = pPipe->ubEnd;

@ -7,83 +7,31 @@
#include <stdio.h>
#ifdef __linux__
#include <sys/time.h> // for gettimeofday()
#elif _WIN32
#include <time.h>
#include <winsock.h>
#endif
#include <iostream>
#include <chrono>
#ifdef WIN32
#define gettimeofday(tp, tzp) \
do {\
time_t clock; struct tm tm; SYSTEMTIME wtm; GetLocalTime(&wtm);\
tm.tm_year = wtm.wYear - 1900;\
tm.tm_mon = wtm.wMonth - 1;\
tm.tm_mday = wtm.wDay;\
tm.tm_hour = wtm.wHour;\
tm.tm_min = wtm.wMinute;\
tm.tm_sec = wtm.wSecond;\
tm.tm_isdst = -1;\
clock = mktime(&tm); (tp)->tv_sec = clock; (tp)->tv_usec = wtm.wMilliseconds * 1000;\
} while (0)
#endif
class stopWatch {
public:
stopWatch() : start_time(std::chrono::steady_clock::now()) {}
struct time_checker
{
struct timeval start_time;
struct timeval stop_time;
void TimeStart()
// 获取经过的时间ms
float elapsed_ms() const
{
gettimeofday(&start_time, nullptr);
auto duration = std::chrono::steady_clock::now() - start_time;
return (std::chrono::duration_cast<std::chrono::microseconds>(duration).count()) / 1000.0f;
}
void TimeStop()
{
gettimeofday(&stop_time, nullptr);
}
int timeDistance()
{
long time_1_token = start_time.tv_sec * 1000 + start_time.tv_usec / 1000;
long time_2_token = stop_time.tv_sec * 1000 + stop_time.tv_usec / 1000;
return time_2_token - time_1_token;
// 重置计时器
void reset() {
start_time = std::chrono::steady_clock::now();
}
void show_distance(const char*title = "current time")
{
long time_1_token = start_time.tv_sec * 1000 + start_time.tv_usec / 1000;
long time_2_token = stop_time.tv_sec * 1000 + stop_time.tv_usec / 1000;
printf("%s : %ld ms\n", title, time_2_token - time_1_token);
}
void show_ns_distance(const char*title = "current time")
{
long time_1_token = start_time.tv_sec * 1000000 + start_time.tv_usec;
long time_2_token = stop_time.tv_sec * 1000000 + stop_time.tv_usec;
printf("%s : %ld ns\n", title, time_2_token - time_1_token);
}
bool timeout(int second)
{
struct timeval current;
gettimeofday(&current, nullptr);
long time_1_token = start_time.tv_sec * 1000 + start_time.tv_usec / 1000;
long time_2_token = current.tv_sec * 1000 + current.tv_usec / 1000;
int value = time_2_token - time_1_token;
return value > second;
}
static long get_current_timetoken()
{
struct timeval current;
gettimeofday(&current, nullptr);
return (current.tv_sec * 1000 + current.tv_usec / 1000);
}
private:
std::chrono::time_point<std::chrono::steady_clock> start_time;
};
#endif //BABY_FACE_NCNN_DEMO_TIMER_H
#endif

@ -9,7 +9,6 @@
*******************************************************************/
#include "Arith_DetectAreaObj.h"
#include "Arith_ImgOperate.h"
#include "Arith_DetectAreaObj.h"
#include "API_DetectSAObj.h"
//#include "../Version.h"
#include "opencv2/opencv.hpp"
@ -1072,8 +1071,8 @@ void DetectAreaObj::DAT_Initialization(SINT32 nWidth, SINT32 nHeight, CENTERRECT
m_DAT_stPara.nObjSizeMax = DAT_TARGET_PXLS_MAX;
m_DAT_stPara.nObjWidthMax = DAT_TARGET_WIDTH_MAX;
m_DAT_stPara.nObjHeightMax = DAT_TARGET_HEIGHT_MAX;
m_DAT_stPara.fObjWHRatioMin = 0.2f;
m_DAT_stPara.fObjWHRatioMax = 5.0f;
m_DAT_stPara.fObjWHRatioMin = 0.25f;
m_DAT_stPara.fObjWHRatioMax = 4.0f;
m_DAT_stPara.fObjRectRatioMin = 0.3f;
m_DAT_stPara.nObjBkgGrayDiffMin = 10;
m_DAT_stPara.fBkgGrayDiffCoeff = 0.35f;

@ -180,13 +180,13 @@ void XLogger::setLevelByFileState()
void XLogger::createAllLogger()
{
const std::string logger_name_prefix = "Neo";
const std::string logger_name_prefix = "NeoLog";
// logger name with timestamp
int date = NowDateToInt();
int time = NowTimeToInt();
const std::string logger_name = logger_name_prefix + std::to_string(date) /*+ "_" + std::to_string(time)*/;
const std::string logger_name = logger_name_prefix /*+ std::to_string(date)*/ /*+ "_" + std::to_string(time)*/;
const std::string logger_name_Input = "Arith_Input";
const std::string logger_name_Output = "Arith_Output";
@ -194,23 +194,23 @@ void XLogger::createAllLogger()
m_logger = spdlog::create_async<spdlog::sinks::rotating_file_sink_mt>(logger_name, log_dir + "/" + logger_name + ".log",
10 * 1024 * 1024, 3); // multi part log files, with every part 500M, max 1000 files
10 * 1024 * 1024, 2); // multi part log files, with every part 500M, max 1000 files
m_logger_in = spdlog::create_async<spdlog::sinks::rotating_file_sink_mt>(logger_name_Input, log_dir + "/" + logger_name_Input + ".log",
50 * 1024 * 1024, 3);//100M循环写入
50 * 1024 * 1024, 2);//100M循环写入
m_logger_out = spdlog::create_async<spdlog::sinks::rotating_file_sink_mt>(logger_name_Output, log_dir + "/" + logger_name_Output + ".log",
50* 1024 * 1024, 3);//100M循环写入
50* 1024 * 1024, 2);//100M循环写入
m_logger_Timer = spdlog::create_async<spdlog::sinks::rotating_file_sink_mt>(logger_name_Timer, log_dir + "/" + logger_name_Timer + ".log",
0.1 * 1024 * 1024, 1); // multi part
10 * 1024 * 1024, 1); // multi part
// 设置输出格式
m_logger->set_pattern(LOG_OUTPUT_FORMAT_SIMPLE);
m_logger_in->set_pattern(LOG_OUTPUT_FORMAT_NONE_10KG);
m_logger_out->set_pattern(LOG_OUTPUT_FORMAT_NONE_10KG);
m_logger_Timer->set_pattern(LOG_OUTPUT_FORMAT_SIMPLE);
m_logger_Timer->set_pattern(LOG_OUTPUT_FORMAT_NONE_10KG);
// 输入日志默认debug其他全关

@ -3,6 +3,7 @@
#include "Arith_Bbox.h"
#include "Version.h"
#include "debugExport.h"
#include "Arith_timer.h"
// 获取外部参数
void ARIDLL_GetInputPara(Arith_EOController* pArith,int nWidth, int nHeight, ARIDLL_INPUTPARA stInputPara);
@ -48,6 +49,9 @@ int ARIDLL_RunController(ArithHandle hArithSrc, GD_VIDEO_FRAME_S img, ARIDLL_INP
stInputPara.unFrmId, img.u32Width, img.u32Height, stInputPara.unFreq, stInputPara.stServoInfo.fServoAz, stInputPara.stServoInfo.fServoPt, stInputPara.stAirCraftInfo.stAtt.fRoll,
stInputPara.stAirCraftInfo.stAtt.fPitch,stInputPara.stAirCraftInfo.stAtt.fYaw,stInputPara.stAirCraftInfo.stPos.B,stInputPara.stAirCraftInfo.stPos.H,stInputPara.stAirCraftInfo.stPos.L,stInputPara.stCameraInfo.fAglReso,
stInputPara.stCameraInfo.nFocus, stInputPara.stCameraInfo.fPixelSize, stInputPara.stCameraInfo.unVideoType);
stopWatch sw;
// 获取算法指针
Arith_EOController* pArith = (Arith_EOController*)hArithSrc;
// 算法暂不支持stride特性先进行stride检查
@ -81,6 +85,12 @@ int ARIDLL_RunController(ArithHandle hArithSrc, GD_VIDEO_FRAME_S img, ARIDLL_INP
// 输出算法结果
ARIDLL_Output(pArith, pstOutput);
if (pstOutput->nStatus != GLB_STATUS_SEARCH)
{
LOG_TIME("[Controller Time]:STATUS:{}, {}ms", pstOutput->nStatus, sw.elapsed_ms());
}
return 0;
}
@ -475,7 +485,7 @@ void ARIDLL_OutputPipeTarget(Arith_EOController* pArith, ARIDLL_OUTPUT* pstOutpu
(pstOutput->nStatus == GLB_STATUS_TRACK || pstOutput->nStatus == GLB_STATUS_MOTRACK))
{
if (ABS(pipeBox.x - trackBox.x) < 256 && ABS(pipeBox.y - trackBox.y) < 256)
if (ABS(pipeBox.x - trackBox.x) < 200 && ABS(pipeBox.y - trackBox.y) < 200)
{
continue;
}
@ -686,14 +696,6 @@ void ARIDLL_OutputPipeTarget(Arith_EOController* pArith, ARIDLL_OUTPUT* pstOutpu
pstOutput->stAlarmObjs[Index] = TempObj;
}
// 跟踪状态不送显示
//if (pstOutput->nTrackObjCnts > 0)
//{
// memset(pstOutput->stAlarmObjs, 0, ST_OBJ_NUM * sizeof(ARIDLL_OBJINFO));
// pstOutput->nAlarmObjCnts = 0;
//}
LOG_DEBUG_OUTPUT("stAlarmObjs[0]nX:{},nY:{}; stTrackers[0]nX:{},nY:{}", pstOutput->stAlarmObjs[0].nX, pstOutput->stAlarmObjs[0].nY, pstOutput->stTrackers[0].nX, pstOutput->stTrackers[0].nY);
}

@ -654,7 +654,7 @@ void MOT_Pipe::PIPE_UpdatePipes(TARGET_OBJECT* ptTargetArray, SINT32 pnFrmObjsCn
pPipe->nDelCntThres = MAX(3, pPipe->nDelCntThres);
// 弱小目标,不容易删除
if (pPipe->ObjectFilter.fPxlsCnt < 5)
if (pPipe->ObjectFilter.fPxlsCnt < 5 && pPipe->stMotionMod_mean.bTrackStable)
{
pPipe->nDelCntThres = 10;
}

@ -33,13 +33,13 @@ void S3315GetImagePara(unsigned char* pImageDataBuffer,unsigned char* pParamData
ImagePara->stAirCraftInfo.stAtt.fYaw = calc_fov_by_mil(pParamNO65DataBuffer->B1B0, 6000) * 6000.0f / 65536.0f;
ImagePara->stAirCraftInfo.stAtt.fPitch = calc_fov_by_mil(pParamNO65DataBuffer->B3B2, 6000) * 6000.0f / 65536.0f;
ImagePara->stAirCraftInfo.stAtt.fRoll = calc_fov_by_mil(pParamNO65DataBuffer->B5B4, 6000) * 6000.0f / 65536.0f;
ImagePara->stCameraInfo.fPixelSize = 25;
ImagePara->unFreq = 50;
// pImageDataBuffer 是热像仪640*513 最后一行是热像仪参数
unsigned short* pIR = ((unsigned short*)pImageDataBuffer);
ImagePara->stCameraInfo.nFocus = pIR[640 * 512 + 64] * 0.1;
ImagePara->stCameraInfo.fPixelSize = pIR[640 * 512 + 29];
/*std::cout << std::hex << std::setw(8) << "pParamDataBuffer" << std::setfill('0') << reinterpret_cast<std::uintptr_t>(pParamDataBuffer) << ": ";

@ -0,0 +1,26 @@
import cv2
import numpy as np
import matplotlib.pyplot as plt
file = open('dump_y16_640x513_2025-08-23-21_47_05.data','rb')
dy500 = np.zeros(1500)
dy300 = np.zeros(1500)
for i in range(1500):
frame = file.read(640*513*2+640*513+640*4)
y8 = np.frombuffer(frame[640*513*2:640*513*2+640*513],dtype=np.uint8).reshape([513,640])
y16 = np.frombuffer(frame[0:640*513*2],dtype=np.uint16).reshape([513,640])
dy500[i] = abs(y16[500,:].astype(np.int16) - (y16[501,:]).astype(np.int16)).mean()
dy300[i] = abs(y16[300,:].astype(np.int16) - (y16[301,:]).astype(np.int16)).mean()
cv2.imshow("",y8)
cv2.waitKey(1)
plt.plot(dy500)
plt.plot(dy300)
plt.show()
Loading…
Cancel
Save