public class KltTracker<InputImage extends boofcv.struct.image.ImageGray,DerivativeImage extends boofcv.struct.image.ImageGray>
extends java.lang.Object
A Kanade-Lucas-Tomasi (KLT) [1,2,3,4] point feature tracker for a single layer gray scale image. It tracks point features across a sequence of images by having each feature individually follow the image's gradient. Feature locations are estimated to within sub-pixel accuracy.
For this particular implementation of KLT, image derivatives is only needed when setDescription() is called. Tracker quality will degrade if features change orientation, but this technique is significantly faster.
Citations:
[1] Bruce D. Lucas and Takeo Kanade. An Iterative Image Registration Technique with an
Application to Stereo Vision. International Joint Conference on Artificial Intelligence,
pages 674-679, 1981.
[2] Carlo Tomasi and Takeo Kanade. Detection and Tracking of Point Features. Carnegie
Mellon University Technical Report CMU-CS-91-132, April 1991.
[3] Jianbo Shi and Carlo Tomasi. Good Features to Track. IEEE Conference on Computer
Vision and Pattern Recognition, pages 593-600, 1994.
[4] Stan Birchfield, http://www.ces.clemson.edu/~stb/klt/
| Modifier and Type | Field and Description |
|---|---|
protected KltConfig |
config |
protected boofcv.struct.image.GrayF32 |
currDesc |
protected DerivativeImage |
derivX |
protected DerivativeImage |
derivY |
protected float |
Ex |
protected float |
Ey |
protected float |
Gxx |
protected float |
Gxy |
protected float |
Gyy |
protected InputImage |
image |
protected boofcv.alg.interpolate.InterpolateRectangle<DerivativeImage> |
interpDeriv |
protected boofcv.alg.interpolate.InterpolateRectangle<InputImage> |
interpInput |
protected int |
lengthFeature |
protected boofcv.struct.image.GrayF32 |
subimage |
protected int |
widthFeature |
| Constructor and Description |
|---|
KltTracker(boofcv.alg.interpolate.InterpolateRectangle<InputImage> interpInput,
boofcv.alg.interpolate.InterpolateRectangle<DerivativeImage> interpDeriv,
KltConfig config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
computeE(KltFeature feature,
float x,
float y) |
protected int |
computeGandE_border(KltFeature feature,
float cx,
float cy)
When part of the region is outside the image G and E need to be recomputed
|
KltConfig |
getConfig() |
float |
getError()
Average absolute value of the difference between each pixel in the image and the template
|
protected boolean |
internalSetDescription(KltFeature feature) |
protected boolean |
internalSetDescriptionBorder(KltFeature feature)
Computes the descriptor for border features.
|
boolean |
isDescriptionComplete(KltFeature feature)
Checks to see if the feature description is complete or if it was created by a feature partially
outside the image
|
boolean |
isFullyInside(float x,
float y)
Returns true if the features is entirely enclosed inside of the image.
|
boolean |
isFullyOutside(float x,
float y)
Returns true if the features is entirely outside of the image.
|
protected void |
setAllowedBounds(KltFeature feature)
Precompute image bounds that the feature is allowed inside of
|
boolean |
setDescription(KltFeature feature)
Sets the features description using the current image and the location of the feature stored in the feature.
|
void |
setImage(InputImage image,
DerivativeImage derivX,
DerivativeImage derivY)
Sets the current image it should be tracking with.
|
KltTrackFault |
track(KltFeature feature)
Updates the feature's location inside the image.
|
void |
unsafe_setImage(InputImage image,
DerivativeImage derivX,
DerivativeImage derivY)
Same as
setImage(InputImage, DerivativeImage, DerivativeImage), but it doesn't check to see if the images are the same size each time |
protected InputImage extends boofcv.struct.image.ImageGray image
protected DerivativeImage extends boofcv.struct.image.ImageGray derivX
protected DerivativeImage extends boofcv.struct.image.ImageGray derivY
protected boofcv.alg.interpolate.InterpolateRectangle<InputImage extends boofcv.struct.image.ImageGray> interpInput
protected boofcv.alg.interpolate.InterpolateRectangle<DerivativeImage extends boofcv.struct.image.ImageGray> interpDeriv
protected KltConfig config
protected float Gxx
protected float Gyy
protected float Gxy
protected float Ex
protected float Ey
protected int widthFeature
protected int lengthFeature
protected boofcv.struct.image.GrayF32 currDesc
protected boofcv.struct.image.GrayF32 subimage
public KltTracker(boofcv.alg.interpolate.InterpolateRectangle<InputImage> interpInput, boofcv.alg.interpolate.InterpolateRectangle<DerivativeImage> interpDeriv, KltConfig config)
public void setImage(InputImage image, DerivativeImage derivX, DerivativeImage derivY)
image - Original input image.derivX - Image derivative along the x-axisderivY - Image derivative along the y-axispublic void unsafe_setImage(InputImage image, DerivativeImage derivX, DerivativeImage derivY)
setImage(InputImage, DerivativeImage, DerivativeImage), but it doesn't check to see if the images are the same size each timepublic boolean setDescription(KltFeature feature)
feature - Feature description which is to be set. Location must be specified.protected boolean internalSetDescription(KltFeature feature)
protected boolean internalSetDescriptionBorder(KltFeature feature)
public KltTrackFault track(KltFeature feature)
Updates the feature's location inside the image. The feature's position can be modified even if tracking fails.
feature - Feature being tracked.protected void setAllowedBounds(KltFeature feature)
protected void computeE(KltFeature feature, float x, float y)
protected int computeGandE_border(KltFeature feature, float cx, float cy)
public boolean isDescriptionComplete(KltFeature feature)
public boolean isFullyInside(float x,
float y)
public boolean isFullyOutside(float x,
float y)
public float getError()
public KltConfig getConfig()