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.

89 lines
1.9 KiB

// 单目标对空跟踪流程测试关注跟踪器FPS
#include "NeoArithStandardDll.h"
#include "utils.h"
#include <iostream>
#include <memory>
#include <string.h>
#include <algorithm>
#include <thread>
#include "opencv2/opencv.hpp"
using std::cout;
using std::endl;
int main()
{
// 产生一个仿真Y16数据
int nWidth = 640;
int nHeight = 512;
SimTargetImage_Y16 factory(nWidth, nHeight);
factory.setBackGround(5000, 10);
// 创建算法句柄
ArithHandle pTracker = STD_CreatEOArithHandle();
// 初始化为凝视-对空模式
ARIDLL_EOArithInitWithMode(pTracker,nWidth,nHeight,GD_PIXEL_FORMAT_E::GD_PIXEL_FORMAT_GRAY_Y16,
GLB_SYS_MODE::GLB_SYS_STARE,GLB_SCEN_MODE::GLB_SCEN_SKY);
// 算法输入部分
ARIDLL_INPUTPARA stInputPara = { 0 };
stInputPara.unFrmId++;
stInputPara.stCameraInfo.fPixelSize = 15;
stInputPara.stCameraInfo.nFocus = 300;
// 算法输出部分
ARIDLL_OUTPUT stOutput = { 0 };
// 模拟算法执行流程
int nDetSuc = 0;
for (int i = 0; i < 300; i++)
{
stInputPara.unFrmId++;
// 创建小目标
factory.setBackGround(5000, 10);
int X0 = 20;
int Y0 = 20;
// 叠加一串小目标
for (int i = 0; i < 10; i++)
{
factory.addTarget(X0 + i * 30, Y0 + i * 30, 3, 3, 6500);
}
// 叠加两个面目标
factory.addTarget(80, 400 , 7, 9, 7500);
factory.addTarget(400, 80 , 9, 6, 7500);
// 创建
// 构建图像类型
GD_VIDEO_FRAME_S img = { 0 };
img.enPixelFormat = GD_PIXEL_FORMAT_E::GD_PIXEL_FORMAT_GRAY_Y16;
img.u32Width = nWidth;
img.u32Height = nHeight;
img.u32Stride[0] = img.u32Width * 2;
img.u64VirAddr[0] = (UBYTE8*)factory.getImageData();
// 红外目标检测API调用
int targetNum = 0;
targetNum = ARIDLL_SearchFrameTargets(pTracker, img);
if (targetNum ==12)
{
nDetSuc++;
}
}
if (nDetSuc > 1)
{
cout << "pass" << endl;
}
return 0;
}