00001
00002
00003
00004
00005
00006
00007 #ifndef _KLT_H_
00008 #define _KLT_H_
00009
00010 typedef float KLT_locType;
00011 typedef unsigned short KLT_PixelType;
00012
00013 #define KLT_BOOL int
00014
00015 #ifndef TRUE
00016 #define TRUE 1
00017 #define FALSE 0
00018 #endif
00019
00020 #ifndef NULL
00021 #define NULL 0
00022 #endif
00023
00024 #define KLT_TRACKED 0
00025 #define KLT_NOT_FOUND -1
00026 #define KLT_SMALL_DET -2
00027 #define KLT_MAX_ITERATIONS -3
00028 #define KLT_OOB -4
00029 #define KLT_LARGE_RESIDUE -5
00030
00031
00032
00033
00034
00035 typedef struct {
00036
00037 int mindist;
00038 int window_width, window_height;
00039 KLT_BOOL sequentialMode;
00040
00041
00042 KLT_BOOL smoothBeforeSelecting;
00043
00044 KLT_BOOL writeInternalImages;
00045
00046
00047 int min_eigenvalue;
00048 float min_determinant;
00049 float min_displacement;
00050 int max_iterations;
00051 float max_residue;
00052 float grad_sigma;
00053 float smooth_sigma_fact;
00054 float pyramid_sigma_fact;
00055 int nSkippedPixels;
00056 int borderx;
00057 int bordery;
00058 int nPyramidLevels;
00059 int subsampling;
00060
00061
00062 void *pyramid_last;
00063 void *pyramid_last_gradx;
00064 void *pyramid_last_grady;
00065 } KLT_TrackingContextRec, *KLT_TrackingContext;
00066
00067
00068 typedef struct {
00069 KLT_locType x;
00070 KLT_locType y;
00071 int val;
00072
00073
00074
00075 } KLT_FeatureRec, *KLT_Feature;
00076
00077 typedef struct {
00078 int nFeatures;
00079 KLT_Feature *feature;
00080 } KLT_FeatureListRec, *KLT_FeatureList;
00081
00082 typedef struct {
00083 int nFrames;
00084 KLT_Feature *feature;
00085 } KLT_FeatureHistoryRec, *KLT_FeatureHistory;
00086
00087 typedef struct {
00088 int nFrames;
00089 int nFeatures;
00090 KLT_Feature **feature;
00091 } KLT_FeatureTableRec, *KLT_FeatureTable;
00092
00093
00094
00095
00096
00097
00098
00099
00100 KLT_TrackingContext KLTCreateTrackingContext(void);
00101 KLT_FeatureList KLTCreateFeatureList(
00102 int nFeatures);
00103 KLT_FeatureHistory KLTCreateFeatureHistory(
00104 int nFrames);
00105 KLT_FeatureTable KLTCreateFeatureTable(
00106 int nFrames,
00107 int nFeatures);
00108
00109
00110 void KLTFreeTrackingContext(
00111 KLT_TrackingContext tc);
00112 void KLTFreeFeatureList(
00113 KLT_FeatureList fl);
00114 void KLTFreeFeatureHistory(
00115 KLT_FeatureHistory fh);
00116 void KLTFreeFeatureTable(
00117 KLT_FeatureTable ft);
00118
00119
00120 void KLTSelectGoodFeatures(
00121 KLT_TrackingContext tc,
00122 KLT_PixelType *img,
00123 int ncols,
00124 int nrows,
00125 KLT_FeatureList fl);
00126 void KLTTrackFeatures(
00127 KLT_TrackingContext tc,
00128 KLT_PixelType *img1,
00129 KLT_PixelType *img2,
00130 int ncols,
00131 int nrows,
00132 KLT_FeatureList fl);
00133 void KLTReplaceLostFeatures(
00134 KLT_TrackingContext tc,
00135 KLT_PixelType *img,
00136 int ncols,
00137 int nrows,
00138 KLT_FeatureList fl);
00139
00140
00141 int KLTCountRemainingFeatures(
00142 KLT_FeatureList fl);
00143 void KLTPrintTrackingContext(
00144 KLT_TrackingContext tc);
00145 void KLTChangeTCPyramid(
00146 KLT_TrackingContext tc,
00147 int search_range);
00148 void KLTUpdateTCBorder(
00149 KLT_TrackingContext tc);
00150 void KLTStopSequentialMode(
00151 KLT_TrackingContext tc);
00152 void KLTSetVerbosity(
00153 int verbosity);
00154 float _KLTComputeSmoothSigma(
00155 KLT_TrackingContext tc);
00156
00157
00158 void KLTStoreFeatureList(
00159 KLT_FeatureList fl,
00160 KLT_FeatureTable ft,
00161 int frame);
00162 void KLTExtractFeatureList(
00163 KLT_FeatureList fl,
00164 KLT_FeatureTable ft,
00165 int frame);
00166 void KLTStoreFeatureHistory(
00167 KLT_FeatureHistory fh,
00168 KLT_FeatureTable ft,
00169 int feat);
00170 void KLTExtractFeatureHistory(
00171 KLT_FeatureHistory fh,
00172 KLT_FeatureTable ft,
00173 int feat);
00174
00175
00176 void KLTWriteFeatureListToPPM(
00177 KLT_FeatureList fl,
00178 KLT_PixelType *greyimg,
00179 int ncols,
00180 int nrows,
00181 char *filename);
00182 void KLTWriteFeatureList(
00183 KLT_FeatureList fl,
00184 char *filename,
00185 char *fmt);
00186 void KLTWriteFeatureHistory(
00187 KLT_FeatureHistory fh,
00188 char *filename,
00189 char *fmt);
00190 void KLTWriteFeatureTable(
00191 KLT_FeatureTable ft,
00192 char *filename,
00193 char *fmt);
00194 KLT_FeatureList KLTReadFeatureList(
00195 KLT_FeatureList fl,
00196 char *filename);
00197 KLT_FeatureHistory KLTReadFeatureHistory(
00198 KLT_FeatureHistory fh,
00199 char *filename);
00200 KLT_FeatureTable KLTReadFeatureTable(
00201 KLT_FeatureTable ft,
00202 char *filename);
00203
00204 #endif