Class TrackerMeanShiftLikelihood<T extends ImageBase<T>>
Mean-shift [1] based tracker which tracks the target inside a likelihood image using a flat rectangular kernel
of fixed size. The likelihood for each pixel is computed using SparseImageSample_F32
. How that
model is computed is not specified by this class, but is often based on color. For sake of efficiency, the
likelihood for a pixel is only computed as needed.
This algorithm can run very fast and works well when the target being tracked is visually distinctive from the background and largely composed of one color. It can't handle changes in scale or shape of the target, which does limit its applications.
[1] Yizong Chen, "Mean Shift, Mode Seeking, and Clustering" IEEE Trans. Pattern Analysis and Machine Intelligence,
VOL. 17, NO. 8, August 1995
-
Constructor Summary
ConstructorDescriptionTrackerMeanShiftLikelihood
(PixelLikelihood<T> targetModel, int maxIterations, float minFractionDrop) Configures tracker -
Method Summary
Modifier and TypeMethodDescriptionCurrent location of target in the imagevoid
initialize
(T image, RectangleLength2D_I32 initial) Specifies the initial target location so that it can learn its descriptionboolean
isFailed()
If true the tracker has filedboolean
Updates the target's location in the image by performing a mean-shift search.void
setTrackLocation
(RectangleLength2D_I32 location) Used to set the location of the track without changing any appearance history.protected void
updatePdfImage
(int x0, int y0, int x1, int y1) Computes the PDF only inside the image as needed amd update the dirty rectangle
-
Constructor Details
-
TrackerMeanShiftLikelihood
public TrackerMeanShiftLikelihood(PixelLikelihood<T> targetModel, int maxIterations, float minFractionDrop) Configures tracker- Parameters:
targetModel
- Target used to model the target's likelihoodmaxIterations
- Maximum number of iterations. try 20minFractionDrop
- If the likelihood drops below its initial value by this fraction the track is assumed to be lost
-
-
Method Details
-
initialize
Specifies the initial target location so that it can learn its description- Parameters:
image
- Imageinitial
- Initial target location and the mean-shift bandwidth
-
setTrackLocation
Used to set the location of the track without changing any appearance history.- Parameters:
location
- new location
-
process
Updates the target's location in the image by performing a mean-shift search. Returns if it was successful at finding the target or not. If it fails once it will need to be re-initialized- Parameters:
image
- Most recent image in the sequence- Returns:
- true for success or false if it failed
-
updatePdfImage
protected void updatePdfImage(int x0, int y0, int x1, int y1) Computes the PDF only inside the image as needed amd update the dirty rectangle -
getLocation
Current location of target in the image- Returns:
- rectangle containing the target
-
isFailed
public boolean isFailed()If true the tracker has filed
-