| 14 | using namespace cv; |
| 15 | |
| 16 | int main(int argc, char* argv[]){ |
| 17 | |
| 18 | if (argc > 5) return -1; |
| 19 | |
| 20 | bool HOG = true; |
| 21 | bool FIXEDWINDOW = false; |
| 22 | bool MULTISCALE = true; |
| 23 | bool SILENT = true; |
| 24 | bool LAB = false; |
| 25 | |
| 26 | for(int i = 0; i < argc; i++){ |
| 27 | if ( strcmp (argv[i], "hog") == 0 ) |
| 28 | HOG = true; |
| 29 | if ( strcmp (argv[i], "fixed_window") == 0 ) |
| 30 | FIXEDWINDOW = true; |
| 31 | if ( strcmp (argv[i], "singlescale") == 0 ) |
| 32 | MULTISCALE = false; |
| 33 | if ( strcmp (argv[i], "show") == 0 ) |
| 34 | SILENT = false; |
| 35 | if ( strcmp (argv[i], "lab") == 0 ){ |
| 36 | LAB = true; |
| 37 | HOG = true; |
| 38 | } |
| 39 | if ( strcmp (argv[i], "gray") == 0 ) |
| 40 | HOG = false; |
| 41 | } |
| 42 | |
| 43 | // Create KCFTracker object |
| 44 | KCFTracker tracker(HOG, FIXEDWINDOW, MULTISCALE, LAB); |
| 45 | |
| 46 | // Frame readed |
| 47 | Mat frame; |
| 48 | |
| 49 | // Tracker results |
| 50 | Rect result; |
| 51 | |
| 52 | // Path to list.txt |
| 53 | ifstream listFile; |
| 54 | string fileName = "images.txt"; |
| 55 | listFile.open(fileName); |
| 56 | |
| 57 | // Read groundtruth for the 1st frame |
| 58 | ifstream groundtruthFile; |
| 59 | string groundtruth = "region.txt"; |
| 60 | groundtruthFile.open(groundtruth); |
| 61 | string firstLine; |
| 62 | getline(groundtruthFile, firstLine); |
| 63 | groundtruthFile.close(); |
| 64 | |
| 65 | istringstream ss(firstLine); |
| 66 | |
| 67 | // Read groundtruth like a dumb |
| 68 | float x1, y1, x2, y2, x3, y3, x4, y4; |
| 69 | char ch; |
| 70 | ss >> x1; |
| 71 | ss >> ch; |
| 72 | ss >> y1; |
| 73 | ss >> ch; |