Package boofcv.alg.video
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:
- Provide: tracker, descriptor, associate, score3D
- Invoke
initialize(int, int)
- Pass each frame into
next(ImageBase)
- Get results from
#getSelectedFrames()
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
What caused to to request a frame be savedclass
Storage for feature and track information for a single image frame -
Field Summary
Modifier and TypeFieldDescriptionfinal ConfigSelectFrames3D
Returns the configuration with tuning parameters used.final DogArray_I32
Indexes of pairs which are considered to be inliers for the dominant model -
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
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.protected double
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 incompleteprotected void
Copies results from image-to-image tracker into the 'currentFrame'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.void
initialize
(int width, int height) Must be called first and initializes data structuresprotected boolean
Checks to see if the scene is nearly identical by the number of features which have barely movedvoid
Retrieves the locations of tracks in the current frame which were visible in the key frameboolean
Process the next frame in the sequenceprotected void
performTracking
(T frame) void
setVerbose
(@Nullable PrintStream out, @Nullable Set<String> configuration)
-
Field Details
-
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
Indexes of pairs which are considered to be inliers for the dominant model
-
-
Constructor Details
-
SelectFramesForReconstruction3D
-
-
Method Details
-
initialize
public void initialize(int width, int height) Must be called first and initializes data structures- Parameters:
width
- Image widthheight
- Image height
-
next
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
Retrieves the locations of tracks in the current frame which were visible in the key frame- Parameters:
tracks
- (Output) Storage for track locations
-
performTracking
-
copyTrackResultsIntoCurrentFrame
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 interfaceVerbosePrint
-