Exemplo n.º 1
0
class Tracks(object):
    """docstring for Tracks"""
    def __init__(self, detection, trackId):
        super(Tracks, self).__init__()
        self.KF = KalmanFilter()
        self.KF.predict()
        self.KF.correct(np.matrix(detection).reshape(2, 1))
        self.trace = deque(maxlen=20)
        self.prediction = detection.reshape(1, 2)
        self.trackId = trackId
        self.skipped_frames = 0

    def predict(self, detection):
        self.prediction = np.array(self.KF.predict()).reshape(1, 2)
        self.KF.correct(np.matrix(detection).reshape(2, 1))
class TrackingObject(object):
	"""
	TrackingObject: maintains and updates all the information 
	for one tracked object
	"""
	def __init__(self, detection, trackId):
		super(TrackingObject, self).__init__()
		self.KF = KalmanFilter()
		self.KF.predict()
		self.KF.correct(np.matrix(detection).reshape(2,1))
		self.trace = deque(maxlen=20)
		self.prediction = detection.reshape(1,2)
		self.trackId = trackId
		self.skipped_frames = 0

	def predict_and_correct(self, measurement):
		self.prediction = np.array(self.KF.predict()).reshape(1,2)
		self.KF.correct(np.matrix(measurement).reshape(2,1))