Fawkes API  Fawkes Development Version
siftpp.h
1 
2 /***************************************************************************
3  * siftpp.h - Feature-based classifier using siftpp
4  *
5  * Created: Sat Apr 12 10:15:23 2008
6  * Copyright 2008 Stefan Schiffer [stefanschiffer.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_CLASSIFIERS_SIFTPP_H_
25 #define __FIREVISION_CLASSIFIERS_SIFTPP_H_
26 
27 #ifndef HAVE_SIFTPP
28 # error SIFTPP not available, you may not use the SiftppClassifier
29 #endif
30 
31 #include <vector>
32 #include <utils/time/clock.h>
33 #include <utils/time/tracker.h>
34 
35 #include <fvclassifiers/classifier.h>
36 
37 // FIXME replace with forward declarations
38 #include <siftpp/sift.hpp>
39 
40 //#ifdef SIFTPP_TIMETRACKER
41 
43 //#endif
44 
45 namespace firevision {
46 #if 0 /* just to make Emacs auto-indent happy */
47 }
48 #endif
49 
51 {
52  public:
53  SiftppClassifier(const char * features_file,
54  int samplingStep = 2,
55  int octaves = 4,
56  int levels = 3,
57  float magnif = 3.0,
58  int noorient = 0,
59  int unnormalized = 0);
60 
61  virtual ~SiftppClassifier();
62 
63  virtual std::list< ROI > * classify();
64 
65  /** Siftpp Feature struct. */
66  struct Feature {
67  VL::Sift::Keypoint key; /**< keypoint */
68  int number_of_desc; /**< number of descriptors */
69  VL::float_t ** descs; /**< descriptors */
70  };
71 
72  private:
73 
74  // Find closest interest point in a list, given one interest point
75  int findMatch(const Feature & ip1, const std::vector< Feature > & ipts);
76 
77  // Calculate square distance of two vectors
78  //double distSquare(double *v1, double *v2, int n);
79  double distSquare(VL::float_t *v1, VL::float_t *v2, int n);
80 
81  // Object objects
82  VL::PgmBuffer *__obj_img;
83  std::vector< Feature > __obj_features;
84  int __obj_num_features;
85 
86  // Image objects
87  VL::PgmBuffer *__image;
88  std::vector< Feature > __img_features;
89  int __img_num_features;
90 
91  // Initial sampling step (default 2)
92  int __samplingStep;
93  // Number of analysed octaves (default 4)
94  int __octaves;
95  // Number of levels per octave (default 3)
96  int __levels;
97  // Blob response treshold
98  VL::float_t __threshold;
99  VL::float_t __edgeThreshold;
100 
101  int __first;
102 
103  // float const __sigman;
104  // float const __sigma0;
105  float __sigman;
106  float __sigma0;
107 
108  // Keypoint magnification (default 3)
109  float __magnif;
110  // Upright SIFTPP or rotation invaraiant
111  int __noorient;
112  // Normalize decriptors?
113  int __unnormalized;
114 
115  // UNUSED
116 // int stableorder = 0 ;
117 // int savegss = 0 ;
118 // int verbose = 0 ;
119 // int binary = 0 ;
120 // int haveKeypoints = 0 ;
121 // int fp = 0 ;
122 
123  // Length of descriptor vector
124  int __vlen;
125 
126  //#ifdef SIFTPP_TIMETRACKER
127  fawkes::TimeTracker *__tt;
128  unsigned int __loop_count;
129  unsigned int __ttc_objconv;
130  unsigned int __ttc_objfeat;
131  unsigned int __ttc_imgconv;
132  unsigned int __ttc_imgfeat;
133  unsigned int __ttc_matchin;
134  unsigned int __ttc_roimerg;
135  //#endif
136 
137 };
138 
139 } // end namespace firevision
140 
141 #endif
SIFTPP classifier.
Definition: siftpp.h:50
virtual ~SiftppClassifier()
Destructor.
Definition: siftpp.cpp:223
Siftpp Feature struct.
Definition: siftpp.h:66
VL::float_t ** descs
descriptors
Definition: siftpp.h:69
VL::Sift::Keypoint key
keypoint
Definition: siftpp.h:67
SiftppClassifier(const char *features_file, int samplingStep=2, int octaves=4, int levels=3, float magnif=3.0, int noorient=0, int unnormalized=0)
Constructor.
Definition: siftpp.cpp:72
int number_of_desc
number of descriptors
Definition: siftpp.h:68
virtual std::list< ROI > * classify()
Classify image.
Definition: siftpp.cpp:235
Time tracking utility.
Definition: tracker.h:38
Classifier to extract regions of interest.
Definition: classifier.h:37