Class SelectFramesForReconstruction3D<T extends ImageBase<T>>

java.lang.Object
boofcv.alg.video.SelectFramesForReconstruction3D<T>
All Implemented Interfaces:
VerbosePrint

public class SelectFramesForReconstruction3D<T extends ImageBase<T>> extends Object implements VerbosePrint
Processes all the frames in a video sequence and decides which frames to keep for 3D reconstruction. The idea here is that file size can be reduced significantly if redundant information is removed. Internally it works by having a key frame that the current frame is compared against. First it checks to see if the image tracker shows any significant motion with its features. If not then this image is considered redundant. Next it computes a homography without doing any robustness filtering, if that describes the relationship well then there's no chance if it being 3d. Then if those tests are inconclusive it will robustly fit a homography and fundamental matrix and compare their fit scores to decide if there's significant 3D structure. Instructions:
  1. Provide: tracker, descriptor, associate, score3D
  2. Invoke initialize(int, int)
  3. Pass each frame into next(ImageBase)
  4. Get results from #getSelectedFrames()
  • Field Details

    • config

      public final ConfigSelectFrames3D config
      Returns the configuration with tuning parameters used. Note that settings for inner classes, e.g. association and model matchers, are ignored. While not elegant, this config design avoids duplicate code and comments.
    • inlierIdx

      public final DogArray_I32 inlierIdx
      Indexes of pairs which are considered to be inliers for the dominant model
  • Constructor Details

  • Method Details

    • initialize

      public void initialize(int width, int height)
      Must be called first and initializes data structures
      Parameters:
      width - Image width
      height - Image height
    • next

      public boolean next(T image)
      Process the next frame in the sequence
      Parameters:
      image - Image. All images are assumed to have the same shape
      Returns:
      true if it decided to add a new keyframe. Might not be the current frame.
    • lookupKeyFrameTracksInCurrentFrame

      public void lookupKeyFrameTracksInCurrentFrame(DogArray<Point2D_F64> tracks)
      Retrieves the locations of tracks in the current frame which were visible in the key frame
      Parameters:
      tracks - (Output) Storage for track locations
    • performTracking

      protected void performTracking(T frame)
    • copyTrackResultsIntoCurrentFrame

      protected void copyTrackResultsIntoCurrentFrame(T image)
      Copies results from image-to-image tracker into the 'currentFrame'
    • createPairsWithKeyFrameTracking

      protected void createPairsWithKeyFrameTracking(SelectFramesForReconstruction3D<T>.Frame keyFrame, SelectFramesForReconstruction3D<T>.Frame current)
      Create a set of image pairs between the key frame and the current frame.
    • isSceneStatic

      protected boolean isSceneStatic()
      Checks to see if the scene is nearly identical by the number of features which have barely moved
      Returns:
      true if it's nearly static
    • checkSkippedBadFrame

      protected boolean checkSkippedBadFrame()
      If tracks are dropped and association does much better that can indicate there was some even (like glare) which caused the tracks to drop but is now gone. In that case save this frame and skip over the bad stuff
    • computeFrameRelativeMotion

      protected double computeFrameRelativeMotion()
      Has there been so much motion that we should save the image anyways? If too many frames are skipped the reconstruction can be bad or incomplete
    • setVerbose

      public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration)
      Specified by:
      setVerbose in interface VerbosePrint