Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Private Attributes
jafar::klt::Klt Class Reference

This class is a Jafar wrapper (using Image) to the KLT tracker. More...


Detailed Description

This class is a Jafar wrapper (using Image) to the KLT tracker.

This class wraps all functions of the klt.h header, which contains all necessary functions to use Birchfield's KLT implementation. Some functions have been added to offer a superior level of use of the tracker. Only added functions are documented, for others please refer to the KLT lib documentation (http://www.ces.clemson.edu/~stb/klt/). All methods have the same name than the original function but with the "KLT" prefix removed.

Warning:
All formats of Image will functions, but you should use u8 grey images with dimensions multiple of 8, because it will save some conversions with memory copies of images.

Definition at line 126 of file klt.hpp.

#include <klt.hpp>

List of all members.

Public Member Functions

 Klt (int maxDisplacement=50, int maxAccel=50, int securityMargin=10, int measureConfidence=10, int initSpeedConfidence=100)
 constructor
KLT_TrackingContext CreateTrackingContext (void)
KLT_FeatureList CreateFeatureList (int nFeatures)
KLT_FeatureHistory CreateFeatureHistory (int nFrames)
KLT_FeatureTable CreateFeatureTable (int nFrames, int nFeatures)
void FreeTrackingContext (KLT_TrackingContext tc)
void FreeFeatureList (KLT_FeatureList fl)
void FreeFeatureHistory (KLT_FeatureHistory fh)
void FreeFeatureTable (KLT_FeatureTable ft)
void SelectGoodFeatures (KLT_TrackingContext tc, image::Image &jImg, KLT_FeatureList fl)
void TrackFeatures (KLT_TrackingContext tc, image::Image &jImg1, image::Image &jImg2, KLT_FeatureList fl)
void ReplaceLostFeatures (KLT_TrackingContext tc, image::Image &jImg, int ncols, int nrows, KLT_FeatureList fl)
void SelectGoodFeaturesObject (KLT_TrackingContext tc, image::Image &jImg, KLT_FeatureList fl, int zone_x=-1, int zone_y=-1, int zone_w=-1, int zone_h=-1, tDate timeStamp=-1)
 select features in an image, restricted to a given area
void TrackFeaturesObject (KLT_TrackingContext tc, image::Image &jImg1, image::Image &jImg2, KLT_FeatureList fl, bool replace=false, tDate timeStamp=-1)
 track features of the object from one image to the next, and replace features on the object if asked
int CountRemainingFeatures (KLT_FeatureList fl)
void PrintTrackingContext (KLT_TrackingContext tc)
void ChangeTCPyramid (KLT_TrackingContext tc, int search_range)
void UpdateTCBorder (KLT_TrackingContext tc)
void StopSequentialMode (KLT_TrackingContext tc)
void SetVerbosity (int verbosity)
float ComputeSmoothSigma (KLT_TrackingContext tc)
void StoreFeatureList (KLT_FeatureList fl, KLT_FeatureTable ft, int frame)
void ExtractFeatureList (KLT_FeatureList fl, KLT_FeatureTable ft, int frame)
void StoreFeatureHistory (KLT_FeatureHistory fh, KLT_FeatureTable ft, int feat)
void ExtractFeatureHistory (KLT_FeatureHistory fh, KLT_FeatureTable ft, int feat)
void WriteFeatureListToPPM (KLT_FeatureList fl, KLT_PixelType *greyimg, int ncols, int nrows, char *filename)
void WriteImageToImg (image::Image &jGreyimg, image::Image &jRGBimg)
 copy grey image in rgb image
void WriteFeatureListToImg (KLT_FeatureList fl, image::Image &jRGBimg)
 draw a representation of feature on the image
void WriteBordersToImg (image::Image &jRGBimg, KLT_TrackingContext tc)
 draw a representation of the working area on the image
void WriteKalmanToImg (image::Image &jRGBimg, KLT_TrackingContext tc)
 draw a representation of kalman informations on the image (positions, speeds, and variances)
void WriteFeatureList (KLT_FeatureList fl, char *filename, char *fmt)
void WriteFeatureHistory (KLT_FeatureHistory fh, char *filename, char *fmt)
void WriteFeatureTable (KLT_FeatureTable ft, char *filename, char *fmt)
KLT_FeatureList ReadFeatureList (KLT_FeatureList fl, char *filename)
KLT_FeatureHistory ReadFeatureHistory (KLT_FeatureHistory fh, char *filename)
KLT_FeatureTable ReadFeatureTable (KLT_FeatureTable ft, char *filename)

Public Attributes

TrackedObject object

Private Attributes

int workingPos [2]
int prevWorkingPos [2]
int workingDims [2]
int prevWorkingDims [2]
int searchingZone [4]
int securityMargin
filter::KalmanFilterkalman
tDate lastTimeStamp
 kalman filter (see filter jafar module)

Constructor & Destructor Documentation

jafar::klt::Klt::Klt ( int  maxDisplacement = 50,
int  maxAccel = 50,
int  securityMargin = 10,
int  measureConfidence = 10,
int  initSpeedConfidence = 100 
) [inline]

constructor

Parameters:
maxDisplacementthe maximum displacement in pixels from one frame to the next, determining the size of the processing area
maxAccelthe maximum acceleration of the object in pixels by frames^2, determining the error of the kalman model (speed is constant)
securityMargina margin to increase the size of the processing area
measureConfidencethe confidence in the measure (barycenter of features representing the object)
initSpeedConfidencethe confidence in the initial speed, that's to say the maximum value of initial speed (because we assume it to be 0 for the first frame)

Definition at line 165 of file klt.hpp.


Member Function Documentation

void jafar::klt::Klt::SelectGoodFeaturesObject ( KLT_TrackingContext  tc,
image::Image jImg,
KLT_FeatureList  fl,
int  zone_x = -1,
int  zone_y = -1,
int  zone_w = -1,
int  zone_h = -1,
tDate  timeStamp = -1 
)

select features in an image, restricted to a given area

This function is an enhancement of the KLT lib's function SelectGoodFeatures, enabling to restrict the selection of features to a given area of the image, or more concretely to a given object.

Parameters:
tcthe tracking context (please refer to the KLT lib documentation)
jImgthe image where select features
flthe feature list for storing found features (please refer to the KLT lib documentation)
zone_xthe x of top left corner of the area where you want to select features in the first image
zone_ythe y of top left corner of the area where you want to select features in the first image
zone_wthe width of the area where you want to select features in the first image
zone_hthe height of the area where you want to select features in the first image
timeStampa time stamp of the image, if default (-1) time stamp is automatically increased of 1 at each frame, so that all speed units are in pixels /frame. If this field is used, to set different dt between frames, be carefull to set speeds in the appropriate unit
void jafar::klt::Klt::TrackFeaturesObject ( KLT_TrackingContext  tc,
image::Image jImg1,
image::Image jImg2,
KLT_FeatureList  fl,
bool  replace = false,
tDate  timeStamp = -1 
)

track features of the object from one image to the next, and replace features on the object if asked

This function is an enhancement of the KLT lib's functions TrackGoodFeatures and ReplaceLostFeatures, enabling to track features only in a small area (determined by a kalman filter) in order to speed up the processing, and to replace lost features on the object (with an elimination of features not on the object)

Parameters:
tcthe tracking context (please refer to the KLT lib documentation)
jImg1the previous image. If sequentialMode is set, this image is generally not used, except if the size of the processing area is changing. So you should always give a correct parameter here.
jImg2the new image where to track features
flthe feature list (please refer to the KLT lib documentation)
replacespecify whether lost features should be replaced when lost or not
timeStampcf SelectGoodFeaturesObject

draw a representation of the working area on the image

Parameters:
jRGBimgthe destination image, which must be a RGB 3-channel image with same dimensions ncols and nrows than jGreyimage, and which MUST be already allocated !
tcthe tracking context used

draw a representation of feature on the image

Parameters:
flthe feature list to draw
jRGBimgthe destination image, which must be a RGB 3-channel image with same dimensions ncols and nrows than jGreyimage, and which MUST be already allocated !
void jafar::klt::Klt::WriteImageToImg ( image::Image jGreyimg,
image::Image jRGBimg 
)

copy grey image in rgb image

Parameters:
jGreyimagethe original grey image
jRGBimgthe destination image, which must be a RGB 3-channel image with same dimensions than jGreyimage, and which MUST be already allocated !

draw a representation of kalman informations on the image (positions, speeds, and variances)

Parameters:
jRGBimgthe destination image, which must be a RGB 3-channel image with same dimensions ncols and nrows than jGreyimage, and which MUST be already allocated !
tcthe tracking context used

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:41 for Jafar by doxygen 1.7.6.1
LAAS-CNRS