Ignore:
Timestamp:
07/23/2009 01:04:04 PM (10 years ago)
Author:
dave
Message:

added face classifier application, not working yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • foam/trunk/vision/src/Classifier.cpp

    r86 r94  
    2929} 
    3030 
    31 void Classifier::AddFeature(int group, const Vector<float> &v)  
     31void Classifier::AddFeatureToGroup(int group, const Vector<float> &v)  
    3232{  
    3333        assert(v.Size()==m_FeatureSize); 
    3434        m_Features[group].push_back(v);  
     35        // possibly overkill to do this each time we add a new feature... 
     36        CalcGroupMeans(); 
    3537} 
    3638 
     
    5052        m_Mean/=m_FeatureSize; 
    5153} 
     54 
     55void Classifier::CalcGroupMeans() 
     56{ 
     57        for (FeatureMap::iterator i=m_Features.begin(); 
     58                i!=m_Features.end(); ++i) 
     59        { 
     60                Vector<float> mean; 
     61                for (FeatureVec::iterator vi = i->second.begin(); vi!=i->second.end(); ++vi) 
     62                { 
     63                        mean+=*vi; 
     64                } 
     65                mean/=i->second.size(); 
     66                m_GroupMeans[i->first]=mean; 
     67        } 
     68} 
     69 
Note: See TracChangeset for help on using the changeset viewer.