/** Make the current frame the first frame in the sequence */
  public void changeKeyFrame() {
    tracker.spawnTracks();
    tracker.setKeyFrame();

    totalSpawned = tracker.getActiveTracks().size();
    worldToKey.set(worldToCurr);
  }
  /**
   * Processes the next frame in the sequence.
   *
   * @param frame Next frame in the video sequence
   * @return If a fatal error occurred or not.
   */
  public boolean process(I frame) {
    // update the feature tracker
    tracker.process(frame);
    totalProcessed++;

    // set up data structures and spawn tracks
    if (totalProcessed == 1) {
      tracker.spawnTracks();
      tracker.setKeyFrame();

      worldToKey.set(worldToInit);
      worldToCurr.set(worldToInit);
      return true;
    }

    // fit the motion model to the feature tracks
    List<KeyFrameTrack> pairs = tracker.getPairs();
    if (!modelMatcher.process((List) pairs)) {
      return false;
    }

    // refine the motion estimate
    if (modelRefiner == null
        || !modelRefiner.fitModel(modelMatcher.getMatchSet(), modelMatcher.getModel(), keyToCurr)) {
      keyToCurr.set(modelMatcher.getModel());
    }

    // Update the motion
    worldToKey.concat(keyToCurr, worldToCurr);

    return true;
  }
 /** Makes the current frame the first frame and discards its past history */
 public void reset() {
   worldToKey.set(worldToInit);
   keyToCurr.set(worldToInit);
   worldToCurr.set(worldToInit);
   tracker.reset();
   tracker.spawnTracks();
   tracker.setKeyFrame();
   totalProcessed = 0;
 }
 public ImagePointTracker<I> getTracker() {
   return tracker.getTracker();
 }