Mercurial > hg > nsaunier > traffic-intelligence
comparison c/track-features.cpp @ 70:a52653dca25d
got track features to compile, updated paths to headers and libraries for OpenCV 2
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sat, 13 Nov 2010 11:20:10 -0500 |
| parents | ef0d7caf8e91 |
| children |
comparison
equal
deleted
inserted
replaced
| 69:cc192d0450b3 | 70:a52653dca25d |
|---|---|
| 5 | 5 |
| 6 #include "opencv/cv.h" | 6 #include "opencv/cv.h" |
| 7 #include "opencv/highgui.h" | 7 #include "opencv/highgui.h" |
| 8 | 8 |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #include <fstream> | |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 using namespace std; | 13 using namespace std; |
| 13 | 14 |
| 14 #define FEAT_VAL(x) ((x) > 0) ? 1 : x // 1 means the features was replaced | 15 #define FEAT_VAL(x) ((x) > 0) ? 1 : x // 1 means the features was replaced |
| 24 KLT_Feature feature; | 25 KLT_Feature feature; |
| 25 | 26 |
| 26 int i,j; | 27 int i,j; |
| 27 string fnamein, fnameout, tmp; | 28 string fnamein, fnameout, tmp; |
| 28 string sequenceDir="../test-images"; | 29 string sequenceDir="../test-images"; |
| 29 FILE* out; | |
| 30 | 30 |
| 31 IplImage *image; | 31 IplImage *image; |
| 32 int width, height; | 32 int width, height; |
| 33 unsigned char *img1, *img2; | 33 unsigned char *img1, *img2; |
| 34 | 34 |
| 142 fnameout = "features.txt";//"features-"%s"-"%d"-"%d"-"%d".txt", sequenceFile, nFeatures, tc->mindist, tc->window_width); | 142 fnameout = "features.txt";//"features-"%s"-"%d"-"%d"-"%d".txt", sequenceFile, nFeatures, tc->mindist, tc->window_width); |
| 143 //KLTWriteFeatureTable(ft, fnameout, "%5.1f"); | 143 //KLTWriteFeatureTable(ft, fnameout, "%5.1f"); |
| 144 | 144 |
| 145 int precision = 2; | 145 int precision = 2; |
| 146 ofstream out; | 146 ofstream out; |
| 147 openWriteScientific(out, fnameout, precision);//out = fopen(fnameout.c_str(),"w"); | 147 ::openWriteScientificPrecision(out, fnameout, precision); |
| 148 | 148 |
| 149 //fprintf(out,"%%StartFrame: 0\n"); | 149 //fprintf(out,"%%StartFrame: 0\n"); |
| 150 //fprintf(out,"%%NumFrames: %d\n",nFrames); | 150 //fprintf(out,"%%NumFrames: %d\n",nFrames); |
| 151 | 151 |
| 152 // 1 feature / line | 152 // 1 feature / line |
| 167 // velocity | 167 // velocity |
| 168 out << "%" << endl; | 168 out << "%" << endl; |
| 169 firstFrameNum = i+1; | 169 firstFrameNum = i+1; |
| 170 lx.clear(); | 170 lx.clear(); |
| 171 ly.clear(); | 171 ly.clear(); |
| 172 } | |
| 172 } | 173 } |
| 174 } | |
| 173 | 175 |
| 174 //fclose(out); | |
| 175 | |
| 176 cvReleaseCapture(&sequence); | 176 cvReleaseCapture(&sequence); |
| 177 | 177 |
| 178 return 1; | 178 return 1; |
| 179 } | 179 } |
| 180 | 180 |
