00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CFeatureExtraction_H
00029 #define CFeatureExtraction_H
00030
00031 #include <mrpt/utils/CMRPTImage.h>
00032 #include <mrpt/utils/CMRPTImageFloat.h>
00033 #include <mrpt/utils/CTicTac.h>
00034 #include <mrpt/vision/CImageConvolution.h>
00035 #include <mrpt/vision/utils.h>
00036 #include <mrpt/vision/CFeature.h>
00037
00038 namespace mrpt
00039 {
00040 namespace vision
00041 {
00042
00043 class MRPTDLLIMPEXP CFeatureExtraction
00044 {
00045
00046
00047 public:
00048 enum TMethodExtraction
00049 {
00050 extMethodKLT = 0,
00051 extMethodHarris,
00052 extMethodBCD,
00053 extMethodSIFT,
00054 extMethodSURF
00055 };
00056
00057 enum TSIFTImplementation
00058 {
00059 LoweBinary = 0,
00060 CSBinary,
00061 VedaldiBinary,
00062 Hess
00063 };
00064
00065 struct MRPTDLLIMPEXP TOptions
00066 {
00069 TOptions();
00070
00073 TMethodExtraction method;
00074
00077 unsigned int patchSize;
00078
00079 struct MRPTDLLIMPEXP TKLTOptions
00080 {
00083 int radius;
00084 float threshold;
00085 float min_distance;
00086 } KLTOptions;
00087
00088 struct MRPTDLLIMPEXP THarrisOptions
00089 {
00092 float threshold;
00093 float k;
00094 float sigma;
00095 int radius;
00096 float min_distance;
00097 } harrisOptions;
00098
00099 struct MRPTDLLIMPEXP TBCDOptions
00100 {
00103 } BCDOptions;
00104
00105 struct MRPTDLLIMPEXP TSIFTOptions
00106 {
00109 TSIFTImplementation implementation;
00110 } SIFTOptions;
00111
00112 } options;
00113
00116 CFeatureExtraction();
00117
00120 virtual ~CFeatureExtraction();
00121
00128 void detectFeatures( const CMRPTImage &img,
00129 CFeatureList &feats,
00130 unsigned int init_ID = 0,
00131 unsigned int nDesiredFeatures = 0,
00132 const TImageROI &ROI = TImageROI());
00133
00138 void computeSiftDescriptors( const CMRPTImage &in_img,
00139 CFeatureList &in_features);
00140
00147 void findMoreFeatures( const CMRPTImage &img,
00148 const CFeatureList &inList,
00149 CFeatureList &outList,
00150 unsigned int nDesiredFeats = 0);
00151
00152 private:
00210
00211
00212
00219 void selectGoodFeaturesKLT(
00220 const CMRPTImage &inImg,
00221 CFeatureList &feats,
00222 unsigned int init_ID = 0,
00223 unsigned int nDesiredFeatures = 0,
00224 void *mask_ = NULL);
00225
00236 void extractFeaturesKLT(
00237 const CMRPTImage &img,
00238 CFeatureList &feats,
00239 unsigned int init_ID = 0,
00240 unsigned int nDesiredFeatures = 0,
00241 unsigned int x_min = 0,
00242 unsigned int x_length = 0,
00243 unsigned int y_min = 0,
00244 unsigned int y_length = 0);
00245
00252 void extractFeaturesKLT(
00253 const CMRPTImage &img,
00254 CFeatureList &feats,
00255 unsigned int init_ID = 0,
00256 unsigned int nDesiredFeatures = 0,
00257 const TImageROI &ROI = TImageROI());
00258
00259
00260
00261
00268 void extractFeaturesBCD(
00269 const CMRPTImage &img,
00270 CFeatureList &feats,
00271 unsigned int init_ID = 0,
00272 unsigned int nDesiredFeatures = 0,
00273 const TImageROI &ROI = TImageROI());
00274
00275
00276
00277
00284 void extractFeaturesSIFT(
00285 const CMRPTImage &img,
00286 CFeatureList &feats,
00287 unsigned int init_ID = 0,
00288 unsigned int nDesiredFeatures = 0,
00289 const TImageROI &ROI = TImageROI());
00290
00291
00292
00293
00300 void extractFeaturesSURF(
00301 const CMRPTImage &img,
00302 CFeatureList &feats,
00303 unsigned int init_ID = 0,
00304 unsigned int nDesiredFeatures = 0,
00305 const TImageROI &ROI = TImageROI());
00306
00307
00308
00309
00310
00316 void* my_scale_space_extrema(
00317 CFeatureList &featList, void* dog_pyr,
00318 int octvs, int intvls, double contr_thr, int curv_thr,
00319 void* storage );
00320
00324 void my_adjust_for_img_dbl( void* features );
00325
00335 void getTimesExtrema( void* dog_pyr, int octvs, int intvls, float row, float col, unsigned int &nMin, unsigned int &nMax );
00336
00344 double getLaplacianValue( void* dog_pyr, int octvs, int intvls, float row, float col );
00345
00351 void insertCvSeqInCFeatureList( void* features, CFeatureList &list, unsigned int init_ID = 0 );
00352
00359 void convertCvSeqInCFeatureList( void* features, CFeatureList &list, unsigned int init_ID = 0, const TImageROI &ROI = TImageROI() );
00360
00364 bool launchExternalApp( char* command );
00365
00366 };
00367 }
00368 }
00369 #endif