00001 00007 #ifndef P_CODEBOOK_ENTRY_HH 00008 #define P_CODEBOOK_ENTRY_HH 00009 00010 #include <limits.h> 00011 #include <blort/Recognizer3D/PNamespace.hh> 00012 #include <blort/Recognizer3D/Array.hh> 00013 #include <blort/Recognizer3D/KeypointDescriptor.hh> 00014 00015 namespace P 00016 { 00017 00018 class KeypointDescriptor; 00019 00020 class CodebookEntry 00021 { 00022 public: 00023 float sqr_sigma; 00024 KeypointDescriptor *model; 00025 P::Array<KeypointDescriptor* > occurrences; 00026 00027 bool good; //-1 false match, 0 false and correct match, 1 only correct match 00028 bool bad; 00029 int cntGood; // count good matches 00030 int cntTime; // ''timestamp'' 00031 double reliability; 00032 00033 CodebookEntry(); 00034 CodebookEntry(KeypointDescriptor *k); 00035 ~CodebookEntry(); 00036 00037 inline unsigned Size(){return occurrences.Size();} 00038 inline void Clear(); 00039 inline KeypointDescriptor *Insert(KeypointDescriptor* oc); 00040 inline bool Insert(KeypointDescriptor* occ, float sqr_sigma); 00041 inline void ComputeModel(); 00042 inline float CombinedSqrSigma(CodebookEntry *c); 00043 inline float CombinedSqrSigma(KeypointDescriptor *occ); 00044 inline bool Combine(CodebookEntry *c); 00045 inline float DistanceSqr(CodebookEntry *c); 00046 00047 }; 00048 00049 inline void DeleteCodebook(Array<CodebookEntry*> &codebook); 00050 00051 } 00052 00053 #include <blort/Recognizer3D/CodebookEntry.ic> 00054 00055 #endif 00056