Class KltTracker<I extends ImageGray<I>,D extends ImageGray<D>>

java.lang.Object
boofcv.alg.tracker.klt.KltTracker<I,D>

public class KltTracker<I extends ImageGray<I>,D extends ImageGray<D>> extends 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/

  • Field Details

    • image

      protected I extends ImageGray<I> image
    • derivX

      @Nullable protected D extends ImageGray<D> derivX
    • derivY

      @Nullable protected D extends ImageGray<D> derivY
    • interpInput

      protected InterpolateRectangle<I extends ImageGray<I>> interpInput
    • interpDeriv

      protected InterpolateRectangle<D extends ImageGray<D>> interpDeriv
    • config

      protected ConfigKlt 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

      protected GrayF32 currDesc
    • subimage

      protected GrayF32 subimage
  • Constructor Details

  • Method Details

    • setImage

      public void setImage(I image, @Nullable D derivX, @Nullable D derivY)
      Sets the current image it should be tracking with.
      Parameters:
      image - Original input image.
      derivX - Image derivative along the x-axis
      derivY - Image derivative along the y-axis
    • setDescription

      public boolean setDescription(KltFeature feature)
      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

      protected boolean internalSetDescription(KltFeature feature, D derivX, D derivY)
    • internalSetDescriptionBorder

      protected boolean internalSetDescriptionBorder(KltFeature feature, D derivX, D derivY)
      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

      public KltTrackFault track(KltFeature feature)

      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

      protected void setAllowedBounds(KltFeature feature)
      Precompute image bounds that the feature is allowed inside of
    • computeE

      protected void computeE(KltFeature feature, float x, float y)
    • computeGandE_border

      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
    • isDescriptionComplete

      public 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
    • 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

      public KltTracker<I,D> copy()
      Creates a copy which can be run in parallel. Data structures which can be shared are shared.