Esempio n. 1
0
void Tracker::ShowTracking(const cv::Mat& target_pad, const cv::Mat& curr_search_region, const BoundingBox& bbox_estimate) const {
    // Resize the target.
    cv::Mat target_resize;
    cv::resize(target_pad, target_resize, cv::Size(227, 227));

    // Show the resized target.
    cv::namedWindow("Target", cv::WINDOW_AUTOSIZE );// Create a window for display.
    cv::imshow("Target", target_resize );                   // Show our image inside it.

    // Resize the image.
    cv::Mat image_resize;
    cv::resize(curr_search_region, image_resize, cv::Size(227, 227));

    // Unscale the estimate to match the rescaled image.
    BoundingBox bbox_estimate_unscaled;
    bbox_estimate.Unscale(image_resize, &bbox_estimate_unscaled);

    // Show the tracking estimate on the image.
    cv::Mat image_with_box;
    image_resize.copyTo(image_with_box);
    bbox_estimate_unscaled.DrawBoundingBox(&image_with_box);

    cv::namedWindow("Estimate", cv::WINDOW_AUTOSIZE );// Create a window for display.
    cv::imshow("Estimate", image_with_box );                   // Show our image inside it.
    cv::waitKey(0);
}
Esempio n. 2
0
void ExampleGenerator::VisualizeExample(const cv::Mat& target_pad,
                                        const cv::Mat& image_rand_focus,
                                        const BoundingBox& bbox_gt_scaled) const {
  const bool save_images = false;

  // Show resized target.
  cv::Mat target_resize;
  cv::resize(target_pad, target_resize, cv::Size(227,227));
  cv::namedWindow("Target object", cv::WINDOW_AUTOSIZE );// Create a window for display.
  cv::imshow("Target object", target_resize);                   // Show our image inside it.
  if (save_images) {
    const string target_name = "Image" + num2str(video_index_) + "_" + num2str(frame_index_) + "target.jpg";
    cv::imwrite(target_name, target_resize);
  }

  // Resize the image.
  cv::Mat image_resize;
  cv::resize(image_rand_focus, image_resize, cv::Size(227, 227));

  // Draw gt bbox.
  BoundingBox bbox_gt_unscaled;
  bbox_gt_scaled.Unscale(image_resize, &bbox_gt_unscaled);
  bbox_gt_unscaled.Draw(0, 255, 0, &image_resize);

  // Show image with bbox.
  cv::namedWindow("Search_region+gt", cv::WINDOW_AUTOSIZE );// Create a window for display.
  cv::imshow("Search_region+gt", image_resize );                   // Show our image inside it.
  if (save_images) {
    const string image_name = "Image" + num2str(video_index_) + "_" + num2str(frame_index_) + "image.jpg";
    cv::imwrite(image_name, image_resize);
  }

  cv::waitKey(0);
}