00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #ifndef QVKLTFEATURETRACKING_H
00026 #define QVKLTFEATURETRACKING_H
00027
00028 #include <QVKLTTracker>
00029 #include <iostream>
00030
00031 using namespace std;
00032
00039 class QVKLTFeatureTracking {
00040 private:
00041 QList<QVKLTTrackerFeature> track;
00042 int firstFrame, lastFrame;
00043
00044 public:
00049 QVKLTFeatureTracking(QVKLTTrackerFeature feature, int firstFrame) {
00050 track = QList<QVKLTTrackerFeature>();
00051 track.append(feature);
00052 this->firstFrame = firstFrame;
00053 this->lastFrame = firstFrame;
00054 };
00055
00057 QVKLTFeatureTracking() {
00058 track = QList<QVKLTTrackerFeature>();
00059 this->firstFrame = -1;
00060 this->lastFrame = -1;
00061 }
00062
00064 QVKLTFeatureTracking(const QVKLTFeatureTracking &ft)
00065 :track(ft.track), firstFrame(ft.firstFrame), lastFrame(ft.lastFrame) { }
00066
00067 ~QVKLTFeatureTracking() { }
00068
00074 void addFeature(const QVKLTTrackerFeature &feature) {
00075 track.append(feature);
00076 lastFrame++;
00077 };
00078
00079
00080
00081
00082
00083
00084
00085
00089 QList<QVKLTTrackerFeature> getFeatureList() const {
00090 return track;
00091 }
00092
00096 int getLastFrame() const {
00097 return lastFrame;
00098 }
00099
00103 int getFirstFrame() const {
00104 return firstFrame;
00105 }
00106
00110 int size() const {
00111 return track.size();
00112 };
00113 };
00114
00121 class QVTrackingManager {
00122 public:
00125 QVTrackingManager(bool removeLostTrackings=true) {
00126 this->trackings = QHash<int, QVKLTFeatureTracking> ();
00127 this->removeLostTrackings = removeLostTrackings;
00128 this->actualFrame = 0;
00129 }
00130
00132 ~QVTrackingManager() { };
00133
00139 void updateTrackings(QHash<int, QVKLTTrackerFeature>* tracks);
00140
00145 QList<int> getTrackingsAtFrame(int frame);
00146
00150 QList<int> getTrackingsAtLastFrame ();
00151
00155 QHash<int, QVKLTFeatureTracking> getTrackings () const {
00156 return trackings;
00157 }
00158
00163 QVKLTFeatureTracking& getFeatureTracking (int id) {
00164 return trackings[id];
00165 }
00166
00167 private:
00168 QHash<int, QVKLTFeatureTracking> trackings;
00169 bool removeLostTrackings;
00170 int actualFrame;
00171 };
00172
00173 #endif // QVKLTFEATURETRACKING_H