Class KltTracker<I extends ImageGray<I>,D extends ImageGray<D>>
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/
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConfigKltprotected GrayF32protected Dprotected Dprotected floatprotected floatprotected floatprotected floatprotected floatprotected Iprotected InterpolateRectangle<D>protected InterpolateRectangle<I>protected intprotected floatprotected GrayF32protected int -
Constructor Summary
ConstructorsConstructorDescriptionKltTracker(InterpolateRectangle<I> interpInput, InterpolateRectangle<D> interpDeriv, ConfigKlt config) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcomputeE(KltFeature feature, float x, float y) protected intcomputeGandE_border(KltFeature feature, float cx, float cy) When part of the region is outside the image G and E need to be recomputedKltTracker<I,D> copy()Creates a copy which can be run in parallel.protected booleaninternalSetDescription(KltFeature feature, D derivX, D derivY) protected booleaninternalSetDescriptionBorder(KltFeature feature, D derivX, D derivY) Computes the descriptor for border features.booleanisDescriptionComplete(KltFeature feature) Checks to see if the feature description is complete or if it was created by a feature partially outside the imagebooleanisFullyInside(float x, float y) Returns true if the features is entirely enclosed inside of the image.booleanisFullyOutside(float x, float y) Returns true if the features is entirely outside of the image.protected voidsetAllowedBounds(KltFeature feature) Precompute image bounds that the feature is allowed inside ofbooleansetDescription(KltFeature feature) Sets the features description using the current image and the location of the feature stored in the feature.voidSets the current image it should be tracking with.track(KltFeature feature) Updates the feature's location inside the image.
-
Field Details
-
image
-
derivX
-
derivY
-
interpInput
-
interpDeriv
-
config
-
Gxx
protected float Gxx -
Gyy
protected float Gyy -
Gxy
protected float Gxy -
Ex
protected float Ex -
Ey
protected float Ey -
maximumDrift
protected float maximumDrift -
widthFeature
protected int widthFeature -
lengthFeature
protected int lengthFeature -
currDesc
-
subimage
-
-
Constructor Details
-
KltTracker
public KltTracker(InterpolateRectangle<I> interpInput, InterpolateRectangle<D> interpDeriv, ConfigKlt config)
-
-
Method Details
-
setImage
Sets the current image it should be tracking with.- Parameters:
image- Original input image.derivX- Image derivative along the x-axisderivY- Image derivative along the y-axis
-
setDescription
Sets the features description using the current image and the location of the feature stored in the feature. If the feature is an illegal location and cannot be set then false is returned.- Parameters:
feature- Feature description which is to be set. Location must be specified.- Returns:
- true if the feature's description was modified.
-
internalSetDescription
-
internalSetDescriptionBorder
Computes the descriptor for border features. All it needs to do is save the pixel value, but derivative information is also computed so that it can reject bad features immediately. -
track
Updates the feature's location inside the image. The feature's position can be modified even if tracking fails.
- Parameters:
feature- Feature being tracked.- Returns:
- If the tracking was successful or not.
-
setAllowedBounds
Precompute image bounds that the feature is allowed inside of -
computeE
-
computeGandE_border
When part of the region is outside the image G and E need to be recomputed -
isDescriptionComplete
Checks to see if the feature description is complete or if it was created by a feature partially outside the image -
isFullyInside
public boolean isFullyInside(float x, float y) Returns true if the features is entirely enclosed inside of the image. -
isFullyOutside
public boolean isFullyOutside(float x, float y) Returns true if the features is entirely outside of the image. A region is entirely outside if not an entire pixel is contained inside the image. So if only 0.999 of a pixel is inside then the whole region is considered to be outside. Can't interpolate nothing... -
copy
Creates a copy which can be run in parallel. Data structures which can be shared are shared.
-