00001
00019 #ifndef __D_T_SCORING_OBJECT__
00020 #define __D_T_SCORING_OBJECT__
00021
00022 #include "BowVector.h"
00023
00024 namespace DBoW2 {
00025
00027 class GeneralScoring
00028 {
00029 public:
00037 virtual double score(const BowVector &v, const BowVector &w) const = 0;
00038
00045 virtual bool mustNormalize(LNorm &norm) const = 0;
00046
00048 static const double LOG_EPS;
00049
00050
00051
00052 };
00053
00060 #define __SCORING_CLASS(NAME, MUSTNORMALIZE, NORM) \
00061 NAME: public GeneralScoring \
00062 { public: \
00063 \
00069 virtual double score(const BowVector &v, const BowVector &w) const; \
00070 \
00071 \
00076 virtual inline bool mustNormalize(LNorm &norm) const \
00077 { norm = NORM; return MUSTNORMALIZE; } \
00078 }
00079
00081 class __SCORING_CLASS(L1Scoring, true, L1);
00082
00084 class __SCORING_CLASS(L2Scoring, true, L2);
00085
00087 class __SCORING_CLASS(ChiSquareScoring, true, L1);
00088
00090 class __SCORING_CLASS(KLScoring, true, L1);
00091
00093 class __SCORING_CLASS(BhattacharyyaScoring, true, L1);
00094
00096 class __SCORING_CLASS(DotProductScoring, false, L1);
00097
00098 #undef __SCORING_CLASS
00099
00100 }
00101
00102 #endif
00103