Changeset 95 for foam/trunk/vision


Ignore:
Timestamp:
07/24/2009 03:33:27 PM (10 years ago)
Author:
dave
Message:

eigenface user classification seems to work on the test video

Location:
foam/trunk/vision/src
Files:
6 edited

Legend:

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

    r94 r95  
    3535        // possibly overkill to do this each time we add a new feature... 
    3636        CalcGroupMeans(); 
     37        //m_GroupMeans[group]=v; 
    3738} 
    3839 
     
    5859                i!=m_Features.end(); ++i) 
    5960        { 
    60                 Vector<float> mean; 
     61                Vector<float> mean(m_FeatureSize); 
     62                mean.Zero(); 
    6163                for (FeatureVec::iterator vi = i->second.begin(); vi!=i->second.end(); ++vi) 
    6264                { 
    6365                        mean+=*vi; 
    6466                } 
    65                 mean/=i->second.size(); 
     67                mean/=i->second.size();          
    6668                m_GroupMeans[i->first]=mean; 
    6769        } 
  • foam/trunk/vision/src/Classifier.h

    r94 r95  
    3535        virtual int Classify(const Vector<float> &f, float &error) = 0; 
    3636         
     37        bool GroupExists(int g) { return m_GroupMeans.find(g)!=m_GroupMeans.end(); } 
     38        Vector<float> GetGroupMean(int g) { return m_GroupMeans[g]; } 
     39         
    3740protected: 
    3841         
  • foam/trunk/vision/src/Image.cpp

    r94 r95  
    183183        cvSetImageROI(m_Image,roi); 
    184184        newimage = cvCreateImage( cvSize(roi.width, roi.height), m_Image->depth, m_Image->nChannels ); 
    185         cvCopy(m_Image,newimage); 
    186         cvReleaseImage(&m_Image); 
     185        cvCopy(m_Image,newimage);        
     186        cvResetImageROI(m_Image); 
    187187        return newimage; 
    188188} 
  • foam/trunk/vision/src/PCA.h

    r94 r95  
    5151        const Vector<float> &GetMean() const { return m_Mean; } 
    5252        unsigned int GetFeatureSize() const { return m_FeatureSize; } 
     53        unsigned int GetParamsSize() const { return m_EigenTransform.GetRows(); } 
    5354         
    5455         
  • foam/trunk/vision/src/PCAClassifier.cpp

    r94 r95  
    2121 
    2222PCAClassifier::PCAClassifier(const PCA &pca) : 
    23 Classifier(pca.GetFeatureSize()), 
     23Classifier(pca.GetParamsSize()), 
    2424m_PCA(pca) 
    2525{ 
     
    3232void PCAClassifier::AddFeature(int group, const Vector<float> &f) 
    3333{ 
    34         AddFeatureToGroup(group, m_PCA.Project(f)); 
     34        Vector<float> p=m_PCA.Project(f); 
     35        AddFeatureToGroup(group, p); 
    3536} 
    3637 
  • foam/trunk/vision/src/PCAClassifier.h

    r94 r95  
    3636        virtual int Classify(const Vector<float> &f, float &error); 
    3737 
     38        PCA &GetPCA() { return m_PCA; } 
     39 
    3840private: 
    3941        void Refresh(); 
Note: See TracChangeset for help on using the changeset viewer.