Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * siftpp.h - Feature-based classifier using siftpp 00004 * 00005 * Created: Sat Apr 12 10:15:23 2008 00006 * Copyright 2008 Stefan Schiffer [stefanschiffer.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __FIREVISION_CLASSIFIERS_SIFTPP_H_ 00025 #define __FIREVISION_CLASSIFIERS_SIFTPP_H_ 00026 00027 #ifndef HAVE_SIFTPP 00028 # error SIFTPP not available, you may not use the SiftppClassifier 00029 #endif 00030 00031 #include <vector> 00032 #include <utils/time/clock.h> 00033 #include <utils/time/tracker.h> 00034 00035 #include <fvclassifiers/classifier.h> 00036 00037 // FIXME replace with forward declarations 00038 #include <siftpp/sift.hpp> 00039 00040 //#ifdef SIFTPP_TIMETRACKER 00041 00042 class fawkes::TimeTracker; 00043 //#endif 00044 00045 namespace firevision { 00046 #if 0 /* just to make Emacs auto-indent happy */ 00047 } 00048 #endif 00049 00050 class SiftppClassifier : public Classifier 00051 { 00052 public: 00053 SiftppClassifier(const char * features_file, 00054 int samplingStep = 2, 00055 int octaves = 4, 00056 int levels = 3, 00057 float magnif = 3.0, 00058 int noorient = 0, 00059 int unnormalized = 0); 00060 00061 virtual ~SiftppClassifier(); 00062 00063 virtual std::list< ROI > * classify(); 00064 00065 /** Siftpp Feature struct. */ 00066 struct Feature { 00067 VL::Sift::Keypoint key; /**< keypoint */ 00068 int number_of_desc; /**< number of descriptors */ 00069 VL::float_t ** descs; /**< descriptors */ 00070 }; 00071 00072 private: 00073 00074 // Find closest interest point in a list, given one interest point 00075 int findMatch(const Feature & ip1, const std::vector< Feature > & ipts); 00076 00077 // Calculate square distance of two vectors 00078 //double distSquare(double *v1, double *v2, int n); 00079 double distSquare(VL::float_t *v1, VL::float_t *v2, int n); 00080 00081 // Object objects 00082 VL::PgmBuffer *__obj_img; 00083 std::vector< Feature > __obj_features; 00084 int __obj_num_features; 00085 00086 // Image objects 00087 VL::PgmBuffer *__image; 00088 std::vector< Feature > __img_features; 00089 int __img_num_features; 00090 00091 // Initial sampling step (default 2) 00092 int __samplingStep; 00093 // Number of analysed octaves (default 4) 00094 int __octaves; 00095 // Number of levels per octave (default 3) 00096 int __levels; 00097 // Blob response treshold 00098 VL::float_t __threshold; 00099 VL::float_t __edgeThreshold; 00100 00101 int __first; 00102 00103 // float const __sigman; 00104 // float const __sigma0; 00105 float __sigman; 00106 float __sigma0; 00107 00108 // Keypoint magnification (default 3) 00109 float __magnif; 00110 // Upright SIFTPP or rotation invaraiant 00111 int __noorient; 00112 // Normalize decriptors? 00113 int __unnormalized; 00114 00115 // UNUSED 00116 // int stableorder = 0 ; 00117 // int savegss = 0 ; 00118 // int verbose = 0 ; 00119 // int binary = 0 ; 00120 // int haveKeypoints = 0 ; 00121 // int fp = 0 ; 00122 00123 // Length of descriptor vector 00124 int __vlen; 00125 00126 //#ifdef SIFTPP_TIMETRACKER 00127 fawkes::TimeTracker *__tt; 00128 unsigned int __loop_count; 00129 unsigned int __ttc_objconv; 00130 unsigned int __ttc_objfeat; 00131 unsigned int __ttc_imgconv; 00132 unsigned int __ttc_imgfeat; 00133 unsigned int __ttc_matchin; 00134 unsigned int __ttc_roimerg; 00135 //#endif 00136 00137 }; 00138 00139 } // end namespace firevision 00140 00141 #endif