网络上出现了很多的动态自动追踪
比较有名的是 卡尔曼滤波 来做追踪,感觉代码很复杂,需要的高等数学知识,这么多年早忘记了
目前还有一种就是最大重叠区域了,前提是每秒处理的帧数最多25fps等,达到物体的运动每帧都能识别到,这样重叠面积就是最好的效果;
//计算重叠面积
float Tool::Point12stackv(
int ax1, int ay1, int ax2, int ay2,
int bx1, int by1, int bx2, int by2)
{
//left, top, bottom,right
int x1 = _MAX(ax1, bx1);
int y1 = _MAX(ay1, by1);
int x2 = _MIN(ax2, bx2);
int y2 = _MIN(ay2, by2);
int m1 = (ax2 - ax1) * (ay2 - ay1);
int m2 = (bx2 - bx1) * (by2 - by1);
int mm = _MIN(m1, m2);
int width = x2 - x1;
int height = y2 - y1;
if (width <= 0 || height <= 0)
return 0;
int mc = width * height;
//if(mc<0)
// return 0;
//printf("相交面积: %d,面积:%d,%d, 重叠率:%.2f\n", mc, m1, m2, mc * 1.0 / mm); //是否包含?
return mc * 1.0 / mm;
}
/** 点的距离 **/
double Tool::PointDistance(int x1, int y1, int x2, int y2)
{
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
多目标追踪:
https://blog.youkuaiyun.com/weixin_44523062/article/details/106283915
https://blog.youkuaiyun.com/u011100984/article/details/38540709
https://blog.youkuaiyun.com/qq_51682716/article/details/118721213
https://zhuanlan.zhihu.com/p/59148865(多目标跟踪:SORT和Deep SORT)
(𝑢, 𝑣, 𝑟, ℎ, ̇𝑥, ̇𝑦, ̇𝑟, ℎ)̇:
其中 (u,v) 代表 bbox 的中心点,宽高比r, 高h,以及对应的在图像坐标上的相对速度
只有python的代码