コード例 #1
0
  public void process(final SimpleImageSequence<T> sequence) {

    if (!sequence.hasNext()) throw new IllegalArgumentException("Empty sequence");

    image = sequence.next();
    gui.setFrame((BufferedImage) sequence.getGuiImage());
    ShowImages.showWindow(gui, "Circulant Tracker");

    //		tracker.initialize(image,273,156,358-273,293-156);

    paused = true;

    while (paused) {
      Thread.yield();
    }

    int totalFrames = 0;
    long totalTime = 0;

    while (sequence.hasNext()) {
      totalFrames++;

      image = sequence.next();
      gui.setFrame((BufferedImage) sequence.getGuiImage());

      long before = System.nanoTime();
      tracker.performTracking(image);
      long after = System.nanoTime();

      totalTime += after - before;
      System.out.println("FPS = " + (totalFrames) / (totalTime / 2e9));

      gui.update(tracker);

      Rectangle2D_F32 r = tracker.getTargetLocation();
      System.out.println("Target: " + r);
      gui.repaint();

      while (paused) {
        Thread.yield();
      }
    }
    System.out.println("DONE");
  }
コード例 #2
0
 @Override
 public void startTracking(int x0, int y0, int x1, int y1) {
   System.out.println(x0 + "," + y0 + "," + x1 + "," + y1);
   tracker.initialize(image, x0, y0, x1 - x0, y1 - y0);
   paused = false;
 }