8 //load region, images and prepare for output
9 VOT vot_io("region.txt", "images.txt", "output.txt");
14 //img = firts frame, initPos = initial position in the first frame
15 cv::Rect init_rect = vot_io.getInitRectangle();
16 vot_io.outputBoundingBox(init_rect);
17 vot_io.getNextImage(image);
19 tracker.init(image, init_rect);
24 while (vot_io.getNextImage(image) == 1){
25 double time_profile_counter = cv::getCPUTickCount();
27 time_profile_counter = cv::getCPUTickCount() - time_profile_counter;
28 std::cout << " -> speed : " << time_profile_counter/((double)cvGetTickFrequency()*1000) << "ms. per frame" << std::endl;
29 avg_time += time_profile_counter/((double)cvGetTickFrequency()*1000);
32 bb = tracker.getBBox();
33 vot_io.outputBoundingBox(cv::Rect(bb.cx - bb.w/2., bb.cy - bb.h/2., bb.w, bb.h));
34 #ifdef VISULIZE_RESULT
35 cv::rectangle(image, cv::Rect(bb.cx - bb.w/2., bb.cy - bb.h/2., bb.w, bb.h), CV_RGB(0,255,0), 2);
36 cv::imshow("output", image);
40 // std::stringstream s;
42 // int countTmp = frames;
43 // s << "imgs" << "/img" << (countTmp/10000);
44 // countTmp = countTmp%10000;
45 // s << (countTmp/1000);
46 // countTmp = countTmp%1000;
47 // s << (countTmp/100);
48 // countTmp = countTmp%100;
49 // s << (countTmp/10);
50 // countTmp = countTmp%10;
54 // //set image output parameters
55 // std::vector<int> compression_params;
56 // compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
57 // compression_params.push_back(90);
58 // cv::imwrite(ss.c_str(), image, compression_params);
61 std::cout << "Average processing speed " << avg_time/frames << "ms. (" << 1./(avg_time/frames)*1000 << " fps)" << std::endl;