Mercurial Hosting > traffic-intelligence
annotate c/feature-based-tracking.cpp @ 142:a3532db00c28
added code to write velocities
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 24 Aug 2011 02:12:06 -0400 |
parents | 6f10a227486c |
children | b32947b002da |
rev | line source |
---|---|
136
0f790de9437e
renamed Feature to Motion files and added code to test blob db
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
135
diff
changeset
|
1 #include "Motion.hpp" |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
2 #include "Parameters.hpp" |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
3 #include "cvutils.hpp" |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
4 #include "utils.hpp" |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
5 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
6 #include "src/Trajectory.h" |
133
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
7 #include "src/TrajectoryDBAccessList.h" |
136
0f790de9437e
renamed Feature to Motion files and added code to test blob db
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
135
diff
changeset
|
8 #include "src/TrajectoryDBAccessBlob.h" |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
9 |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
10 #include "opencv2/core/core.hpp" |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
11 #include "opencv2/highgui/highgui.hpp" |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
12 //#include "opencv2/imgproc/imgproc.hpp" |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
13 #include "opencv2/features2d/features2d.hpp" |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
14 |
125
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
15 #include <boost/shared_ptr.hpp> |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
16 #include <boost/foreach.hpp> |
125
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
17 |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
18 #include <iostream> |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
19 //#include <list> |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
20 #include <vector> |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
21 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
22 using namespace std; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
23 using namespace cv; |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
24 |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
25 void drawMatchesRelative(const vector<KeyPoint>& train, const vector<KeyPoint>& query, std::vector<cv::DMatch>& matches, Mat& img) { |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
26 for (int i = 0; i < (int)matches.size(); i++) |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
27 { |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
28 Point2f pt_new = query[matches[i].queryIdx].pt; |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
29 Point2f pt_old = train[matches[i].trainIdx].pt; |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
30 Point2f dist = pt_new - pt_old; |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
31 if (norm(dist) < 20) { |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
32 line(img, pt_new, pt_old, Scalar(125, 255, 125), 1); |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
33 circle(img, pt_old, 2, Scalar(255, 0, 125), 1); |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
34 } |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
35 } |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
36 } |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
37 |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
38 void drawOpticalFlow(const vector<Point2f>& prevPts, const vector<Point2f>& currPts, const vector<uchar> status, Mat& img) { |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
39 for (unsigned int i=0; i<status.size(); i++) { |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
40 if (status[i]) { |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
41 line(img, prevPts[i], currPts[i], Scalar(125, 255, 125), 1); |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
42 circle(img, prevPts[i], 2, Scalar(255, 0, 125), 1); |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
43 } |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
44 } |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
45 } |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
46 |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
47 struct FeaturePointMatch { |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
48 FeatureTrajectoryPtr feature; |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
49 int pointNum; |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
50 |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
51 FeaturePointMatch(FeatureTrajectoryPtr _feature, const int& _pointNum): |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
52 feature(_feature), pointNum(_pointNum) {} |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
53 }; |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
54 |
142
a3532db00c28
added code to write velocities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
141
diff
changeset
|
55 inline void saveFeatures(vector<FeatureTrajectoryPtr>& features, TrajectoryDBAccess<Point2f>& db, const string& positionsTableName, const string& velocitiesTableName, const unsigned int& minNFeatures = 0) { |
140
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
56 if (features.size() >= minNFeatures) { |
142
a3532db00c28
added code to write velocities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
141
diff
changeset
|
57 BOOST_FOREACH(FeatureTrajectoryPtr f, features) f->write(db, positionsTableName, velocitiesTableName); |
140
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
58 features.clear(); |
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
59 } |
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
60 } |
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
61 |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
62 int main(int argc, char *argv[]) { |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
63 // BriefDescriptorExtractor brief(32); |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
64 // const int DESIRED_FTRS = 500; |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
65 // GridAdaptedFeatureDetector detector(new FastFeatureDetector(10, true), DESIRED_FTRS, 4, 4); |
125
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
66 |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
67 VideoCapture capture; |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
68 Mat frame, currentFrameBW, previousFrameBW; |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
69 |
137
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
70 KLTFeatureTrackingParameters params(argc, argv); |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
71 cout << params.parameterDescription << endl; |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
72 |
137
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
73 float minTotalFeatureDisplacement = params.nDisplacements*params.minFeatureDisplacement; |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
74 Size window = Size(params.windowSize, params.windowSize); |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
75 |
125
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
76 BruteForceMatcher<Hamming> descMatcher; |
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
77 vector<DMatch> matches; |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
78 Size videoSize; |
125
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
79 |
137
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
80 // if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) // if no parameter or number parameter |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
81 // capture.open(argc == 2 ? argv[1][0] - '0' : 0); |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
82 // else if( argc >= 2 ) |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
83 // { |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
84 // capture.open(argv[1]); |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
85 // if( capture.isOpened() ) |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
86 // videoSize = Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT)); |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
87 // cout << "Video " << argv[1] << |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
88 // ": width=" << videoSize.width << |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
89 // ", height=" << videoSize.height << |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
90 // ", nframes=" << capture.get(CV_CAP_PROP_FRAME_COUNT) << endl; |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
91 // if( argc > 2 && isdigit(argv[2][0]) ) // could be used to reach first frame, dumping library messages to log file (2> /tmp/log.txt) |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
92 // { |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
93 // sscanf(argv[2], "%d", ¶ms.frame1); |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
94 // cout << "seeking to frame #" << params.frame1 << endl; |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
95 // //cap.set(CV_CAP_PROP_POS_FRAMES, pos); |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
96 // for (int i=0; i<params.frame1; i++) |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
97 // capture >> frame; |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
98 // } |
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
99 // } |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
100 |
137
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
101 capture.open(params.videoFilename); |
138
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
102 if(capture.isOpened()) { |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
103 videoSize = Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT)); |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
104 cout << "Video " << argv[1] << |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
105 ": width=" << videoSize.width << |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
106 ", height=" << videoSize.height << |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
107 ", nframes=" << capture.get(CV_CAP_PROP_FRAME_COUNT) << endl; |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
108 } else { |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
109 cout << "Video filename " << params.videoFilename << " could not be opened. Exiting." << endl; |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
110 exit(0); |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
111 } |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
112 // if (!capture.isOpened()) |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
113 // { |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
114 // //help(argv); |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
115 // cout << "capture device " << argv[1] << " failed to open!" << endl; |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
116 // return 1; |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
117 // } |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
118 |
133
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
119 // database |
140
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
120 boost::shared_ptr<TrajectoryDBAccess<Point2f> > trajectoryDB = boost::shared_ptr<TrajectoryDBAccess<Point2f> >(new TrajectoryDBAccessList<Point2f>()); |
136
0f790de9437e
renamed Feature to Motion files and added code to test blob db
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
135
diff
changeset
|
121 //TrajectoryDBAccess<Point2f>* trajectoryDB = new TrajectoryDBAccessBlob<Point2f>(); |
138
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
122 trajectoryDB->connect(params.databaseFilename.c_str()); |
142
a3532db00c28
added code to write velocities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
141
diff
changeset
|
123 trajectoryDB->createTable("positions"); |
a3532db00c28
added code to write velocities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
141
diff
changeset
|
124 trajectoryDB->createTable("velocities"); |
a3532db00c28
added code to write velocities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
141
diff
changeset
|
125 trajectoryDB->beginTransaction(); |
133
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
126 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
127 vector<KeyPoint> prevKpts, currKpts; |
130
2a6e7a9a5c53
changed to goodFeaturesToTrack instead of generic detectors
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
128
diff
changeset
|
128 vector<Point2f> prevPts, currPts, newPts; |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
129 vector<uchar> status; |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
130 vector<float> errors; |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
131 Mat prevDesc, currDesc; |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
132 |
140
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
133 vector<FeatureTrajectoryPtr> lostFeatures; |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
134 vector<FeaturePointMatch> featurePointMatches; |
130
2a6e7a9a5c53
changed to goodFeaturesToTrack instead of generic detectors
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
128
diff
changeset
|
135 |
133
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
136 int key = '?'; |
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
137 unsigned int savedFeatureId=0; |
141
6f10a227486c
modifications to get nframes option working on the command line
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
140
diff
changeset
|
138 for (int frameNum = params.frame1; ((frameNum-params.frame1 < params.nFrames) || (params.nFrames < 0)) && !::interruptionKey(key); frameNum++) { |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
139 capture >> frame; |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
140 cout << frameNum << " " << capture.get(CV_CAP_PROP_POS_FRAMES) << " " << prevPts.size() << endl; |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
141 while (frame.empty()) |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
142 capture >> frame;//break; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
143 |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
144 cvtColor(frame, currentFrameBW, CV_RGB2GRAY); |
130
2a6e7a9a5c53
changed to goodFeaturesToTrack instead of generic detectors
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
128
diff
changeset
|
145 |
2a6e7a9a5c53
changed to goodFeaturesToTrack instead of generic detectors
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
128
diff
changeset
|
146 // "normal" feature detectors: detect features here |
2a6e7a9a5c53
changed to goodFeaturesToTrack instead of generic detectors
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
128
diff
changeset
|
147 // detector.detect(currentFrameBW, currKpts); // see video_homography c++ sample |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
148 |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
149 if (!prevPts.empty()) { |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
150 //::keyPoints2Points(prevKpts, prevPts); |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
151 currPts.clear(); |
137
445e773c9be3
created the parameter structure to parse parameters (bug remaining)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
152 calcOpticalFlowPyrLK(previousFrameBW, currentFrameBW, prevPts, currPts, status, errors, window, params.pyramidLevel, TermCriteria(3 /*static_cast<int>(TermCriteria::COUNT)+static_cast<int>(TermCriteria::EPS)*/, params.maxNumberTrackingIterations, params.minTrackingError), 0.5 /* unused */, 0); // OPTFLOW_USE_INITIAL_FLOW |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
153 |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
154 vector<Point2f> trackedPts; |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
155 vector<FeaturePointMatch>::iterator iter = featurePointMatches.begin(); |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
156 while (iter != featurePointMatches.end()) { |
135
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
157 bool deleteFeature = false; |
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
158 |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
159 if (status[iter->pointNum]) { |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
160 iter->feature->addPoint(frameNum, currPts[iter->pointNum]); |
135
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
161 |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
162 deleteFeature |= iter->feature->smallDisplacement(params.nDisplacements, minTotalFeatureDisplacement) |
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
163 || !iter->feature->motionSmooth(params.accelerationBound, params.deviationBound); |
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
164 if (deleteFeature) |
138
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
165 iter->feature->shorten(); |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
166 } else |
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
167 deleteFeature = true; |
135
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
168 |
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
169 if (deleteFeature) { |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
170 if (iter->feature->length() >= params.minFeatureTime) { |
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
171 iter->feature->setId(savedFeatureId); |
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
172 savedFeatureId++; |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
173 /// \todo smoothing |
140
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
174 //iter->feature->write(*trajectoryDB); |
8de5e8256224
added function to save vectors of features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
139
diff
changeset
|
175 lostFeatures.push_back(iter->feature); |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
176 } |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
177 iter = featurePointMatches.erase(iter); |
138
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
178 } else { |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
179 trackedPts.push_back(currPts[iter->pointNum]); |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
180 iter->pointNum = trackedPts.size()-1; |
135
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
181 iter++; |
138
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
137
diff
changeset
|
182 } |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
183 } |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
184 currPts = trackedPts; |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
185 assert(currPts.size() == featurePointMatches.size()); |
142
a3532db00c28
added code to write velocities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
141
diff
changeset
|
186 saveFeatures(lostFeatures, *trajectoryDB, "positions", "velocities"); |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
187 |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
188 if (params.display) { |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
189 BOOST_FOREACH(FeaturePointMatch fp, featurePointMatches) |
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
190 fp.feature->draw(frame, Colors::red()); |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
191 } |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
192 //drawOpticalFlow(prevPts, currPts, status, frame); |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
193 |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
194 // cout << matches.size() << " matches" << endl; |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
195 // descMatcher.match(currDesc, prevDesc, matches); |
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
196 // cout << matches.size() << " matches" << endl; |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
197 //drawMatchesRelative(prevKpts, currKpts, matches, frame); |
125
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
198 } |
28907fde9855
work on klt tracker (problem on computer at poly)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
124
diff
changeset
|
199 |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
200 // adding new features, using mask around existing feature positions |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
201 Mat featureMask = Mat::ones(videoSize, CV_8UC1); |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
202 for (unsigned int n=0;n<currPts.size(); n++) |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
203 for (int j=MAX(0, currPts[n].x-params.minFeatureDistanceKLT); j<MIN(videoSize.width, currPts[n].x+params.minFeatureDistanceKLT+1); j++) |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
204 for (int i=MAX(0, currPts[n].y-params.minFeatureDistanceKLT); i<MIN(videoSize.height, currPts[n].y+params.minFeatureDistanceKLT+1); i++) |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
205 featureMask.at<uchar>(i,j)=0; |
130
2a6e7a9a5c53
changed to goodFeaturesToTrack instead of generic detectors
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
128
diff
changeset
|
206 goodFeaturesToTrack(currentFrameBW, newPts, params.maxNFeatures, params.featureQuality, params.minFeatureDistanceKLT, featureMask, params.windowSize, params.useHarrisDetector, params.k); |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
207 BOOST_FOREACH(Point2f p, newPts) { //for (unsigned int i=0; i<newPts.size(); i++) { |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
208 FeatureTrajectoryPtr f = FeatureTrajectoryPtr(new FeatureTrajectory(frameNum, p)); |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
209 featurePointMatches.push_back(FeaturePointMatch(f, currPts.size())); |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
210 currPts.push_back(p); |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
211 } |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
130
diff
changeset
|
212 // currPts.insert(currPts.end(), newPts.begin(), newPts.end()); |
130
2a6e7a9a5c53
changed to goodFeaturesToTrack instead of generic detectors
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
128
diff
changeset
|
213 //::keyPoints2Points(currKpts, currPts, false); |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
214 |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
215 //brief.compute(currentFrameBW, currKpts, currDesc); //Compute brief descriptors at each keypoint location |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
216 |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
217 if (params.display) { |
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
218 imshow("frame", frame); |
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
219 imshow("mask", featureMask*256); |
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
220 key = waitKey(2); |
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
221 } |
127
d19d6e63dd77
simple feature tracking and drawing working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
125
diff
changeset
|
222 previousFrameBW = currentFrameBW.clone(); |
128
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
223 prevPts = currPts; |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
224 //prevKpts = currKpts; |
536510f60854
new features generated as needed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
127
diff
changeset
|
225 //currDesc.copyTo(prevDesc); |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
226 } |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
227 |
142
a3532db00c28
added code to write velocities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
141
diff
changeset
|
228 trajectoryDB->endTransaction(); |
136
0f790de9437e
renamed Feature to Motion files and added code to test blob db
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
135
diff
changeset
|
229 trajectoryDB->disconnect(); |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
230 return 0; |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
231 } |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
232 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
233 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
234 /* ------------------ DOCUMENTATION ------------------ */ |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
235 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
236 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
237 /*! \mainpage |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
238 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
239 This project is a collection of software tools for transportation called Traffic Intelligence. Other documents are: |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
240 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
241 - \ref feature_based_tracking |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
242 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
243 The code is partially self-described using the doxygen tool and comment formatting. The documentation can be extracted using doxygen, typing \c doxygen in the main directory (or <tt>make doc</tt> on a system with the Makefile tool installed). |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
244 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
245 */ |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
246 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
247 /*! \page feature_based_tracking Feature-based Tracking: User Manual |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
248 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
249 This document describes a software tool for object tracking in video data, developed for road traffic monitoring and safety diagnosis. It is part of a larger collection of software tools for transportation called Traffic Intelligence. |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
250 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
251 The tool relies on feature-based tracking, a robust object tracking methods, particularly suited for the extraction of traffic data such as trajectories and speeds. The best description of this method is given in <a href="http://nicolas.saunier.confins.net/data/saunier06crv.html">this paper</a>. The program has a command line interface and this document will shortly explain how to use the tool. Keep in mind this is a work in progress and major changes are continuously being made. |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
252 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
253 \section License |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
254 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
255 The code is licensed under the MIT open source license (http://www.opensource.org/licenses/mit-license). |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
256 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
257 If you make use of this piece of software, please cite one of my paper, e.g. N. Saunier, T. Sayed and K. Ismail. Large Scale Automated Analysis of Vehicle Interactions and Collisions. Transportation Research Record: Journal of the Transportation Research Board, 2147:42-50, 2010. I would be very happy in any case to know about any use of the code, and to discuss any opportunity for collaboration. |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
258 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
259 Contact me at nicolas.saunier@polymtl.ca and learn more about my work at http://nicolas.saunier.confins.net. |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
260 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
261 */ |