public class TldTracker<T extends boofcv.struct.image.ImageGray<T>,D extends boofcv.struct.image.ImageGray<D>>
extends java.lang.Object
Main class for Tracking-Learning-Detection (TLD) [1] (a.k.a Predator) object tracker for video sequences. TLD tracks an object which is specified by a user using a rectangle. The description of the object is dynamically updated using P and N constraints.
To start tracking initialize(ImageGray, int, int, int, int) must first be called
to specify the region being tracked. Then each time a new image in the sequences arrives
track(ImageGray) is called. Be sure to check its return value to see if tracking
was successful or not. If tracking fails one frame it can recover. This is often the case where an object
becomes obscured and then visible again.
NOTE: This implementation is based the description found in [1]. The spirit of the original algorithm is replicated, but there are a several algorithmic changes. The most significant modifications are as follow; 1) The KLT tracker used to update the rectangle does not use NCC features to validate a track or the median based outlier removal. Instead a robust model matching algorithm finds the best fit motion. 2) The non-maximum suppression algorithm has been changed so that it computes a more accurate local maximum and only uses local rectangles to compute the average response. 3) Fern selection is done by selecting the N best using a likelihood ratio conditional on the current image. 4) Learning only happens when a track is considered strong. See code for more details. Note, this is not a port of the OpenTLD project.
[1] Zdenek Kalal, "Tracking-Learning-Detection" University of Surrey, April 2011 Phd Thesis.
| Constructor and Description |
|---|
TldTracker(TldParameters config,
boofcv.alg.interpolate.InterpolatePixelS<T> interpolate,
boofcv.abst.filter.derivative.ImageGradient<T,D> gradient,
java.lang.Class<T> imageType,
java.lang.Class<D> derivType)
Configures the TLD tracker
|
| Modifier and Type | Method and Description |
|---|---|
TldParameters |
getConfig() |
TldDetection<T> |
getDetection() |
georegression.struct.shapes.Rectangle2D_F64 |
getTargetRegion()
Returns the estimated location of the target in the current image
|
TldTemplateMatching<T> |
getTemplateMatching() |
georegression.struct.shapes.Rectangle2D_F64 |
getTrackerRegion() |
protected boolean |
hypothesisFusion(boolean trackingWorked,
boolean detectionWorked)
Combines hypotheses from tracking and detection.
|
void |
initialize(T image,
int x0,
int y0,
int x1,
int y1)
Starts tracking the rectangular region.
|
boolean |
isPerformLearning() |
static int[] |
selectPyramidScale(int imageWidth,
int imageHeight,
int minSize)
Selects the scale for the image pyramid based on image size and feature size
|
void |
setPerformLearning(boolean performLearning) |
void |
setTrackerLocation(int x0,
int y0,
int x1,
int y1)
Used to set the location of the track without changing any appearance history.
|
boolean |
track(T image)
Updates track region.
|
public TldTracker(TldParameters config, boofcv.alg.interpolate.InterpolatePixelS<T> interpolate, boofcv.abst.filter.derivative.ImageGradient<T,D> gradient, java.lang.Class<T> imageType, java.lang.Class<D> derivType)
config - Configuration class which specifies the tracker's behaviorpublic void initialize(T image, int x0, int y0, int x1, int y1)
image - First image in the sequence.x0 - Top-left corner of rectangle. x-axisy0 - Top-left corner of rectangle. y-axisx1 - Bottom-right corner of rectangle. x-axisy1 - Bottom-right corner of rectangle. y-axispublic void setTrackerLocation(int x0,
int y0,
int x1,
int y1)
public boolean track(T image)
image - Next image in the sequence.protected boolean hypothesisFusion(boolean trackingWorked,
boolean detectionWorked)
trackingWorked - If the sequential tracker updated the track region successfully or notpublic static int[] selectPyramidScale(int imageWidth,
int imageHeight,
int minSize)
public boolean isPerformLearning()
public void setPerformLearning(boolean performLearning)
public TldTemplateMatching<T> getTemplateMatching()
public georegression.struct.shapes.Rectangle2D_F64 getTargetRegion()
public georegression.struct.shapes.Rectangle2D_F64 getTrackerRegion()
public TldParameters getConfig()
public TldDetection<T> getDetection()