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