00001
00002
00003 #ifndef SAMS_DETECTOR_HPP
00004 #define SAMS_DETECTOR_HPP
00005
00006 #include <vector>
00007 #include <string>
00008 #include "kernel/keyValueFile.hpp"
00009 #include "image/Image.hpp"
00010 #include "gfm/HarrisLaplaceDetector.hpp"
00011 #include "sams/feature.hpp"
00012
00013 namespace jafar {
00014 namespace sams {
00015
00019 class Detector : public jafar::kernel::KeyValueFileSaveLoad {
00020 public:
00021 virtual ~Detector() {};
00022
00027 virtual void compute(const jafar::image::Image& src_,
00028 std::vector< jafar::sams::Feature *>& fVec_) const =0;
00029
00030 };
00031
00038 class SSDetector : public Detector {
00039 public :
00042 SSDetector() : byDefault(true) {};
00043
00047 SSDetector(const std::string& file_);
00048
00059 SSDetector(bool harrisPreProc_,
00060 int startScale_,
00061 int stopScale_,
00062 int nbins_,
00063 double yt_,
00064 double wt_,
00065 bool fplogpFlag_,
00066 int fplogpprec_ = 10000);
00067
00069 virtual ~SSDetector() {
00070 };
00071
00072
00077 virtual void compute(const jafar::image::Image& src_,
00078 std::vector< jafar::sams::Feature *>& fVec_) const;
00079
00080
00081 protected:
00085 void loadKeyValueFile(jafar::kernel::KeyValueFile const& keyValueFile);
00086
00090 void saveKeyValueFile(jafar::kernel::KeyValueFile& keyValueFile);
00091
00092 private:
00094 bool byDefault;
00096 bool harrisPreProc;
00098 int startScale;
00100 int stopScale;
00102 int nbins;
00104 double yt;
00106 double wt;
00108 bool fplogpFlag;
00110 int fplogpprec;
00111
00113 std::vector<double> fplogp;
00114
00117 void do_CalcSalScale1D(const jafar::image::Image &Image_,
00118 std::vector<jafar::sams::Feature *> &fVec_) const;
00119
00122 void clusterize(std::vector<jafar::sams::Feature *>& features_,
00123 std::vector<jafar::sams::Feature *>& clust_) const;
00124
00125
00126 };
00127
00128
00132 class DOGDetector : public Detector {
00133 public:
00134 DOGDetector () {};
00135 virtual ~DOGDetector () {};
00136
00141 virtual void compute(const jafar::image::Image& src_,
00142 std::vector< jafar::sams::Feature *>& fVec_) const;
00143 protected:
00147 void loadKeyValueFile(jafar::kernel::KeyValueFile const& keyValueFile) {
00148 JFR_WARNING("SIFTDetector::loadKeyValueFile: Not implemented");
00149 };
00150
00154 void saveKeyValueFile(jafar::kernel::KeyValueFile& keyValueFile){
00155 JFR_WARNING("SIFTDetector::saveKeyValueFile: Not implemented");
00156 };
00157 };
00158
00162 class SHDetector : public Detector {
00163 public:
00164 struct Params {
00166 int startScale;
00168 int stopScale;
00170 int nbins;
00172 double yt;
00174 double wt;
00176 int max_count;
00177
00178 Params(int start=3,int stop=33, int bins=16, double y=0.0, double w=0.5,int mc=500) :
00179 startScale(start), stopScale(stop), nbins(bins), yt(y), wt(w), max_count(mc) {};
00180 };
00181
00182 SHDetector(Params params_=Params()) : params(params_) {};
00183
00185 virtual ~SHDetector() {
00186 };
00187
00188
00193 virtual void compute(const jafar::image::Image& src_,
00194 std::vector< jafar::sams::Feature *>& fVec_) const;
00195 protected:
00199 void loadKeyValueFile(jafar::kernel::KeyValueFile const& keyValueFile) {
00200 JFR_WARNING("SHDetector::loadKeyValueFile: Not implemented");
00201 };
00202
00206 void saveKeyValueFile(jafar::kernel::KeyValueFile& keyValueFile){
00207 JFR_WARNING("SHDetector::saveKeyValueFile: Not implemented");
00208 };
00209 private:
00210 Params params;
00211 };
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 }
00249 }
00250
00251 #endif // SAMS_DETECTOR_HPP
00252