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

    totalSpawned = tracker.getActiveTracks().size();
    worldToKey.set(worldToCurr);
  }
Exemplo n.º 2
0
  /**
   * 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;
  }
Exemplo n.º 3
0
 /** 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;
 }