Package boofcv.abst.tracker
Class PointTrackerKltPyramid<I extends ImageGray<I>,D extends ImageGray<D>>
java.lang.Object
boofcv.abst.tracker.PointTrackerKltPyramid<I,D>
- All Implemented Interfaces:
PointTracker<I>
- Direct Known Subclasses:
PointTrackerKltPyramid_MT
public class PointTrackerKltPyramid<I extends ImageGray<I>,D extends ImageGray<D>>
extends Object
implements PointTracker<I>
Wrapper around
PyramidKltTracker for PointTracker. Every track
will have the same size and shaped descriptor. If any fault is encountered the track will be dropped.-
Nested Class Summary
Nested classes/interfaces inherited from interface boofcv.abst.tracker.PointTracker
PointTracker.Dropper -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<PyramidKltFeature>protected ConfigKltprotected PointTrackerKltPyramid<I,D>.boofcv.abst.tracker.PointTrackerKltPyramid.ImageStruct protected List<PyramidKltFeature>protected longprotected ImageGradient<I,D> protected Iprotected PointTrackerKltPyramid<I,D>.boofcv.abst.tracker.PointTrackerKltPyramid.ImageStruct protected List<PyramidKltFeature>protected intprotected doubleprotected longprotected PyramidKltTracker<I,D> protected List<PyramidKltFeature> -
Constructor Summary
ConstructorsConstructorDescriptionPointTrackerKltPyramid(ConfigKlt config, double toleranceFB, int templateRadius, boolean performPruneClose, PyramidDiscrete<I> pyramid, GeneralFeatureDetector<I, D> detector, ImageGradient<I, D> gradient, InterpolateRectangle<I> interpInput, InterpolateRectangle<D> interpDeriv, Class<D> derivType) Constructor which specified the KLT track manager and how the image pyramids are computed. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToList(List<PyramidKltFeature> in, List<PointTrack> out) protected voidaddToTracks(float scaleBottom, QueueCorner found) @Nullable PointTrackaddTrack(double x, double y) Creates a new feature track at the specified location.protected voidTrack back to the previous frame and see if the original coordinate is found again.protected booleanReturns true if a new track can be spawned here.voidDrops all feature to be dropped and will no longer be tracked.booleandropTrack(PointTrack track) Manually forces a track to be dropped.voiddropTracks(PointTracker.Dropper dropper) Used to drop multiple tracks using a rule.getActiveTracks(@Nullable List<PointTrack> list) Returns a list of active tracks.getAllTracks(@Nullable List<PointTrack> list) Returns a list of all features that are currently being trackedgetDroppedTracks(@Nullable List<PointTrack> list) Returns a list of tracks dropped by the tracker during the most recent update.longReturns the ID of the most recently processed frame.Input image typegetInactiveTracks(@Nullable List<PointTrack> list) KLT does not have inactive tracks since all tracks are dropped if a problem occurs.intReturns the maximum total number of tracks that it can spawn in a single frame.getNewTracks(@Nullable List<PointTrack> list) Returns a list of tracks that have been added since process was called.intReturns the total number of active tracksintReturns total number of inactive tracksprotected PyramidKltFeatureChecks to see if there's an unused track that can be recycled.voidProcess input image and perform tracking.protected voidPrune tracks which are too close and adds them to the dropped listvoidreset()Discard memory of all current and past tracks.voidAutomatically selects new features in the image to track.protected voidtrackFeatures(I image) Tracks features in the forward direction
-
Field Details
-
configMaxTracks
-
input
-
frameID
protected long frameID -
gradient
-
toleranceFB
protected double toleranceFB -
currPyr
-
prevPyr
-
derivType
-
config
-
templateRadius
protected int templateRadius -
active
-
spawned
-
dropped
-
unused
-
tracker
-
totalFeatures
protected long totalFeatures
-
-
Constructor Details
-
PointTrackerKltPyramid
public PointTrackerKltPyramid(ConfigKlt config, double toleranceFB, int templateRadius, boolean performPruneClose, PyramidDiscrete<I> pyramid, GeneralFeatureDetector<I, D> detector, ImageGradient<I, D> gradient, InterpolateRectangle<I> interpInput, InterpolateRectangle<D> interpDeriv, Class<D> derivType) Constructor which specified the KLT track manager and how the image pyramids are computed.- Parameters:
config- KLT tracker configurationtoleranceFB- Tolerance in pixels for right to left validation. Disable with a value less than 0.templateRadius- Radius of square templates that are trackedperformPruneClose- If true it will prune tracks that are within the detection radiuspyramid- The image pyramid which KLT is tracking inside ofdetector- Feature detector. If null then no feature detector will be available and spawn won't work.gradient- Computes gradient image pyramid.interpInput- Interpolation used on input imageinterpDeriv- Interpolation used on gradient imagesderivType- Type of image the gradient is
-
-
Method Details
-
addTrack
Creates a new feature track at the specified location. Must only be called afterprocess(ImageGray)has been called. It can fail if there is insufficient texture- Parameters:
x- x-coordinatey- y-coordinate- Returns:
- the new track if successful or null if no new track could be created
-
getUnusedTrack
Checks to see if there's an unused track that can be recycled. if not it will create a new one -
spawnTracks
public void spawnTracks()Description copied from interface:PointTrackerAutomatically selects new features in the image to track. Returned tracks must be unique and not duplicates of any existing tracks. This includes both active and inactive tracks. NOTE: This function may or may not also modify the active and inactive lists.- Specified by:
spawnTracksin interfacePointTracker<I extends ImageGray<I>>
-
getImageType
Description copied from interface:PointTrackerInput image type- Specified by:
getImageTypein interfacePointTracker<I extends ImageGray<I>>
-
addToTracks
-
checkValidSpawn
Returns true if a new track can be spawned here. Intended to be overloaded -
dropAllTracks
public void dropAllTracks()Description copied from interface:PointTrackerDrops all feature to be dropped and will no longer be tracked.NOTE: Tracks dropped using this function will not appear in the dropped list.
- Specified by:
dropAllTracksin interfacePointTracker<I extends ImageGray<I>>
-
getMaxSpawn
public int getMaxSpawn()Description copied from interface:PointTrackerReturns the maximum total number of tracks that it can spawn in a single frame. This number is reduced by the number of active tracks. So if the maximum number of tracks it can spawn is 200 and 50 tracks are active then it will spawn at most 150 tracks. If there is no limit then a number ≤ 0 is returned.- Specified by:
getMaxSpawnin interfacePointTracker<I extends ImageGray<I>>
-
process
Description copied from interface:PointTrackerProcess input image and perform tracking.- Specified by:
processin interfacePointTracker<I extends ImageGray<I>>- Parameters:
image- Next image in the sequence
-
trackFeatures
Tracks features in the forward direction -
pruneCloseTracks
protected void pruneCloseTracks()Prune tracks which are too close and adds them to the dropped list -
backwardsTrackValidate
protected void backwardsTrackValidate()Track back to the previous frame and see if the original coordinate is found again. This assumes that all tracks in active list existed in the previous frame and were not spawned. -
dropTrack
Description copied from interface:PointTrackerManually forces a track to be dropped. New requests to all and active lists will not include the track after it has been dropped using this function. If request is made to drop a track that is not being tracked (in the internal all list), then the request is ignored.NOTE: Tracks dropped using this function will not appear in the dropped list.
- Specified by:
dropTrackin interfacePointTracker<I extends ImageGray<I>>- Parameters:
track- The track which is to be dropped- Returns:
- true if the request to drop the track was done or if it was ignored because the track wasn't being tracked
-
dropTracks
Description copied from interface:PointTrackerUsed to drop multiple tracks using a rule. This can be more efficient than dropping them one at a time.NOTE: Tracks dropped using this function will not appear in the dropped list.
- Specified by:
dropTracksin interfacePointTracker<I extends ImageGray<I>>- Parameters:
dropper- Rule for dropping the tracks
-
getActiveTracks
Description copied from interface:PointTrackerReturns a list of active tracks. An active track is defined as a track which was found in the most recently processed image.- Specified by:
getActiveTracksin interfacePointTracker<I extends ImageGray<I>>- Parameters:
list- Optional storage for the list of tracks. List is cleared before tracks are added. If null a new list will be declared internally.- Returns:
- List of tracks.
-
getInactiveTracks
KLT does not have inactive tracks since all tracks are dropped if a problem occurs.- Specified by:
getInactiveTracksin interfacePointTracker<I extends ImageGray<I>>- Parameters:
list- Optional storage for the list of tracks. List is cleared before tracks are added. If null a new list will be declared internally.- Returns:
- List of tracks.
-
getDroppedTracks
Description copied from interface:PointTrackerReturns a list of tracks dropped by the tracker during the most recent update. Tracks dropped by user request are not included in this list.- Specified by:
getDroppedTracksin interfacePointTracker<I extends ImageGray<I>>- Parameters:
list- Optional storage for the list of tracks. List is cleared before tracks are added. If null a new list will be declared internally.- Returns:
- List of tracks.
-
getNewTracks
Description copied from interface:PointTrackerReturns a list of tracks that have been added since process was called.- Specified by:
getNewTracksin interfacePointTracker<I extends ImageGray<I>>- Parameters:
list- Optional storage for the list of tracks. List is cleared before tracks are added. If null a new list will be declared internally.- Returns:
- List of tracks.
-
getAllTracks
Description copied from interface:PointTrackerReturns a list of all features that are currently being tracked- Specified by:
getAllTracksin interfacePointTracker<I extends ImageGray<I>>- Parameters:
list- Optional storage for the list of tracks. List is cleared before tracks are added. If null a new list will be declared internally.- Returns:
- List of tracks.
-
addToList
-
reset
public void reset()Description copied from interface:PointTrackerDiscard memory of all current and past tracks. Growing buffered might not be reset to their initial size by this method.- Specified by:
resetin interfacePointTracker<I extends ImageGray<I>>
-
getFrameID
public long getFrameID()Description copied from interface:PointTrackerReturns the ID of the most recently processed frame. Frames start at 0 and increment by one each time process is called. After reset or before any frames have been processed -1 is returned.- Specified by:
getFrameIDin interfacePointTracker<I extends ImageGray<I>>
-
getTotalActive
public int getTotalActive()Description copied from interface:PointTrackerReturns the total number of active tracks- Specified by:
getTotalActivein interfacePointTracker<I extends ImageGray<I>>
-
getTotalInactive
public int getTotalInactive()Description copied from interface:PointTrackerReturns total number of inactive tracks- Specified by:
getTotalInactivein interfacePointTracker<I extends ImageGray<I>>
-