Subversion Repositories Code-Repo

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#pragma once

#include "GlobalDefines.h"

// Distance before two points are considered separate objects
#define OBJECT_DISTANCE_THRESHOLD 20
// Length of the history to store
#define HISTORY_DEPTH 10

class KalmanFilter;

typedef struct {
        int ID;
        cv::Point2f last_known_pt;
        cv::Point2f predicted_pt;
        float velocity;
        float angle;
        KalmanFilter *filter;
        bool valid;
        std::list<cv::Point2f> history;
        cv::Point2f historyAvg;
} MOVING_OBJECT;

class MovingPointTracker {
public:
        MovingPointTracker();
        ~MovingPointTracker();

        std::vector<MOVING_OBJECT> update(std::vector<cv::Point2f>);

private:
        float pointDistance(cv::Point2f &, cv::Point2f &);

        int nextID;
        int active_objects;
        std::vector<MOVING_OBJECT> objects;
};