来源:::opencv3计算机视觉(python语言实现)第8.4.3节
卡尔曼滤波器+CAMShift算法
版本::::opencv4.1+python3.7
import cv2
import numpy as np
import os.path as path
import argparse
parse=argparse.ArgumentParser()
parse.add_argument("-a","-algorithm",
help="m(or nothing) for meanShift and c for camshift")
args=vars(parse.parse_args())
def center(points):
x = (points[0][0] + points[1][0] + points[2][0] + points[3][0]) / 4
y = (points[0][1] + points[1][1] + points[2][1] + points[3][1]) / 4
return np.array([np.float32(x), np.float32(y)], np.float32)
font=cv2.FONT_HERSHEY_SIMPLEX
class Pedestrian():
def __init__(self,id,frame,track_window):
self.id=int(id)
x,y,w,h=track_window
self.track_window=track_window
self.roi=cv2.cvtColor(frame[y:y+h,x:x&#
一个基于行人追踪的例子!
最新推荐文章于 2024-06-18 12:08:16 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)