int option_index = 0;
static struct option long_options[] = {
{"debug", no_argument, 0, 'd' },
+ {"visualDebug", no_argument, 0, 'p'},
{"help", no_argument, 0, 'h' },
{"output", required_argument, 0, 'o' },
{"visualize", optional_argument, 0, 'v' },
{0, 0, 0, 0 }
};
- int c = getopt_long(argc, argv, "dhv::f::o:", long_options, &option_index);
+ int c = getopt_long(argc, argv, "dphv::f::o:", long_options, &option_index);
if (c == -1)
break;
case 'd':
tracker.m_debug = true;
break;
+ case 'p':
+ tracker.m_visual_debug = true;
+ visualize_delay = 500;
+ break;
case 'h':
std::cerr << "Usage: \n"
<< argv[0] << " [options]\n"
std::cout << std::endl;
if (visualize_delay >= 0) {
- cv::rectangle(image, bb_rect, CV_RGB(0,255,0), 2);
- cv::imshow("output", image);
+ cv::Point pt(bb.cx, bb.cy);
+ cv::Size size(bb.w, bb.h);
+ cv::RotatedRect rotatedRectangle(pt, size, bb.a);
+
+ cv::Point2f vertices[4];
+ rotatedRectangle.points(vertices);
+
+ for (int i = 0; i < 4; i++)
+ cv::line(image, vertices[i], vertices[(i + 1) % 4], cv::Scalar(0, 255, 0), 2);
+ cv::imshow("KCF output", image);
int ret = cv::waitKey(visualize_delay);
- if (visualize_delay > 0 && ret != -1 && ret < 128)
+ if ((visualize_delay > 0 && ret != -1 && ret < 128) ||
+ (visualize_delay == 0 && (ret == 27 /*esc*/ || ret == 'q')))
break;
+
}
// std::stringstream s;