Mercurial Hosting > traffic-intelligence
annotate c/feature-based-tracking.cpp @ 124:1e68e18b1aa5
renaming and working on klt
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 16 Aug 2011 12:31:22 -0400 |
parents | df3bdd8e50ba |
children | 28907fde9855 |
rev | line source |
---|---|
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
1 //#include "Feature.hpp" |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
2 #include "Parameters.hpp" |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
3 #include "utils.hpp" |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
4 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
5 #include "src/Trajectory.h" |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
6 |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
7 #include "opencv2/highgui/highgui.hpp" |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
8 //#include "opencv2/imgproc/imgproc.hpp" |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
9 #include "opencv2/features2d/features2d.hpp" |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
10 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
11 #include <iostream> |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
12 //#include <list> |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
13 #include <vector> |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
14 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
15 using namespace std; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
16 using namespace cv; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
17 |
119
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
117
diff
changeset
|
18 //#include "cv.h" |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
19 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
20 using namespace std; |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
21 |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
22 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
|
23 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
|
24 { |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
25 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
|
26 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
|
27 Point2f dist = pt_new - pt_old; |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
28 if (norm(dist) < 20) { |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
29 cv::line(img, pt_new, pt_old, Scalar(125, 255, 125), 1); |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
30 cv::circle(img, pt_new, 2, Scalar(255, 0, 125), 1); |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
31 } |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
32 } |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
33 } |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
34 |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
35 int main(int argc, char *argv[]) { |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
36 vector<TrajectoryPoint2f> features; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
37 BriefDescriptorExtractor brief(32); |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
38 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
39 VideoCapture capture; |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
40 |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
41 Mat frame, display; |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
42 KLTFeatureTrackingParameters params; |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
43 params.frame1 = 0; |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
44 params.nFrames = -1; |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
45 // TODO ajouter klt paremeters, reprendre code de |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
46 // GoodFeaturesToTrackDetector feature_detector(Params.max_nfeatures, Params.feature_quality, Params.min_feature_distance_klt, Params.window_size, Params.useHarrisDetector_GoodFeaturesToTrackDetector, Params.k_GoodFeaturesToTrackDetector); |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
47 // search descriptor_match.h |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
48 |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
49 if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) // if no parameter or number parameter |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
50 capture.open(argc == 2 ? argv[1][0] - '0' : 0); |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
51 else if( argc >= 2 ) |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
52 { |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
53 capture.open(argv[1]); |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
54 if( capture.isOpened() ) |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
55 cout << "Video " << argv[1] << |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
56 ": width=" << capture.get(CV_CAP_PROP_FRAME_WIDTH) << |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
57 ", height=" << capture.get(CV_CAP_PROP_FRAME_HEIGHT) << |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
58 ", nframes=" << capture.get(CV_CAP_PROP_FRAME_COUNT) << endl; |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
59 if( argc > 2 && isdigit(argv[2][0]) ) // could be used to reach first frame, dumping library messages to log file (2> /tmp/log.txt) |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
60 { |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
61 sscanf(argv[2], "%d", ¶ms.frame1); |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
62 cout << "seeking to frame #" << params.frame1 << endl; |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
63 //cap.set(CV_CAP_PROP_POS_FRAMES, pos); |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
64 for (int i=0; i<params.frame1; i++) |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
65 capture >> frame; |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
66 } |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
67 } |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
68 |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
69 // capture.open(atoi(argv[1])); |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
70 if (!capture.isOpened()) |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
71 { |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
72 //help(argv); |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
73 cout << "capture device " << argv[1] << " failed to open!" << endl; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
74 return 1; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
75 } |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
76 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
77 vector<DMatch> matches; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
78 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
79 BruteForceMatcher<Hamming> desc_matcher; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
80 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
81 vector<KeyPoint> prevKpts, currKpts; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
82 vector<unsigned char> match_mask; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
83 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
84 Mat gray; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
85 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
86 Mat prevDesc, currDesc; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
87 const int DESIRED_FTRS = 500; |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
88 GridAdaptedFeatureDetector detector(new FastFeatureDetector(10, true), DESIRED_FTRS, 4, 4); |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
89 |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
90 // TODO structure de donnee paires pointeur trajectory, numero de keypoint |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
91 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
92 for (int frameNum = 0; (params.frame1+frameNum < params.nFrames) || (params.nFrames < 0); frameNum++) { |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
93 frameNum++; |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
94 //capture.set(CV_CAP_PROP_POS_FRAMES, frameNum); |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
95 //capture.grab();capture.grab();capture.retrieve(frame); |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
96 capture >> frame; |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
97 //cout << capture.get(CV_CAP_PROP_POS_FRAMES) << endl; |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
98 while (frame.empty()) |
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
99 capture >> frame;//break; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
100 |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
101 cvtColor(frame, gray, CV_RGB2GRAY); |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
102 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
103 detector.detect(gray, currKpts); |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
104 //cout << currKpts.size() << " kpts" << endl; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
105 |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
106 brief.compute(gray, currKpts, currDesc); //Compute brief descriptors at each keypoint location |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
107 |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
108 //display = frame.clone(); |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
109 if (!prevKpts.empty()) |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
110 { |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
111 desc_matcher.match(currDesc, prevDesc, matches); |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
112 cout << "matches:" << matches.size() << endl; |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
113 drawMatchesRelative(prevKpts, currKpts, matches, frame); |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
114 //drawMatches(frame, prevKpts, frame, currKpts, matches, display);//, Scalar::all(-1), Scalar::all(-1), vector<vector<char> >(), DrawMatchesFlags::DRAW_OVER_OUTIMG); |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
115 } |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
116 |
123
df3bdd8e50ba
displays tracking from video and webcam
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
122
diff
changeset
|
117 imshow("frame", frame); |
124
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
118 prevKpts = currKpts; |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
119 currDesc.copyTo(prevDesc); |
1e68e18b1aa5
renaming and working on klt
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
123
diff
changeset
|
120 int key = waitKey(0); |
122
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
121 if (::interruptionKey(key)) |
654f1c748644
work on displaying matched features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
121
diff
changeset
|
122 break; |
121
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
123 } |
c4d4b5b93add
copied the video_homography opencv sample
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
124 |
117
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
125 return 0; |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
126 } |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
127 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
128 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
129 /* ------------------ DOCUMENTATION ------------------ */ |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
130 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
131 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
132 /*! \mainpage |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
133 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
134 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
|
135 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
136 - \ref feature_based_tracking |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
137 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
138 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
|
139 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
140 */ |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
141 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
142 /*! \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
|
143 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
144 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
|
145 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
146 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
|
147 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
148 \section License |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
149 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
150 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
|
151 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
152 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
|
153 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
154 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
|
155 |
fea680fb03ee
created main feature based tracking file and minimum doxygen documentation
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
156 */ |