Changeset 86 for foam/trunk/vision/src/LDAClassifier.h
 Timestamp:
 06/02/2009 11:15:10 AM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

foam/trunk/vision/src/LDAClassifier.h
r85 r86 20 20 #include "Vector.h" 21 21 #include "Matrix.h" 22 #include "Classifier.h" 22 23 23 24 #ifndef FOAM_LDA_CLASSIFIER … … 26 27 // A linear discriminant analysis classifier for arbitrary data sets 27 28 28 template<class T> 29 class LDAClassifier 29 class LDAClassifier : public Classifier 30 30 { 31 31 public: … … 33 33 ~LDAClassifier(); 34 34 35 class Feature 36 { 37 public: 38 Vector<T> m_Data; 39 int m_Class; 40 }; 41 42 void AddFeature(const Feature &f); 43 int Classify(const Feature &f); 35 virtual int Classify(const Vector<float> &f); 44 36 45 37 private: 46 38 47 void CalcClasses(); 48 void CalcGlobalMean(); 49 void CalcClassMeans(); 39 void CalcGroupMeans(); 50 40 void CalcMeanCorrected(); 51 41 void CalcCovariance(); 52 42 void CalcPooledCovariance(); 53 43 void CalcPriorProbablity(); 54 55 unsigned int m_FeatureSize;56 std::vector<Feature > m_Features;57 44 58 std::set<int> m_Classes; 59 Vector<T> m_GlobalMean; 60 std::map<int,Vector<T> > m_ClassMeans; 61 std::map<int,Matrix<T> > m_MeanCorrected; 62 std::map<int,Matrix<T> > m_Covariance; 63 Matrix<T> m_PooledCovariance; 64 Vector<T> m_PriorProbability; 45 std::map<int,Vector<float> > m_GroupMean; 46 std::map<int,Matrix<float> > m_MeanCorrected; 47 std::map<int,Matrix<float> > m_Covariance; 48 //Matrix<T> m_PooledCovariance; 49 //Vector<T> m_PriorProbability; 65 50 66 51 }; 67 52 68 template<class T>69 LDAClassifier<T>::LDAClassifier(unsigned int FeatureSize)70 {71 }72 73 template<class T>74 LDAClassifier<T>::~LDAClassifier()75 {76 }77 78 template<class T>79 void LDAClassifier<T>::AddFeature(const Feature &f)80 {81 m_Features.push_back(f);82 }83 84 template<class T>85 int LDAClassifier<T>::Classify(const Feature &f)86 {87 return 0;88 }89 90 template<class T>91 void LDAClassifier<T>::CalcClasses()92 {93 m_Classes.clear();94 for (typename std::vector<Feature >::iterator i=m_Features.begin();95 i!=m_Features.end(); ++i)96 {97 m_Classes.insert(i>m_Class);98 }99 }100 101 template<class T>102 void LDAClassifier<T>::CalcGlobalMean()103 {104 105 }106 107 template<class T>108 void LDAClassifier<T>::CalcClassMeans()109 {110 }111 112 template<class T>113 void LDAClassifier<T>::CalcMeanCorrected()114 {115 }116 117 template<class T>118 void LDAClassifier<T>::CalcCovariance()119 {120 }121 122 template<class T>123 void LDAClassifier<T>::CalcPooledCovariance()124 {125 }126 127 template<class T>128 void LDAClassifier<T>::CalcPriorProbablity()129 {130 }131 132 53 #endif
Note: See TracChangeset
for help on using the changeset viewer.