#ifndef OneDollarRec_h__ #define OneDollarRec_h__ #include #include #include "CVUtils.h" using std::vector; using namespace cv; namespace pagic { struct RecResult { int m_templateID; double m_dis; int m_score; double m_length; double m_damageScale; }; class OneDollarRec { public: OneDollarRec(bool enableTotalResample = true); RecResult recognize(const vector& tarPosVec); vector getTemplatePath(int id) { if(id >= 0 && id < m_templates.size()) { return m_templates[id]; } else { return vector(); } } vector getCurResampledPath() const { return m_curResampledPath; } // // static void resample(vector& tarPosVec, int n); // static double pathLength(const vector& posVec); protected: int normalizeScore(double val); void rotateAlign(vector& tarPosVec); void scaleTranslateAlign(vector& tarPosVec, Sized tarSized); void scaleTranslateAlign(vector& tarPosVec, int templateID); double distance(const vector& tarPosVec, int templateID); //double distance(const vector& tarPosVec, const vector& tempPosVec); void normalizeTemplate(vector& vec); //void xmirror(vector& vec); //void ymirror(vector& vec); void addNewTemplate(const vector& vec); Sized getNormalizedSized(); vector< vector > m_templates; vector< vector > m_xmTemplates; vector< vector > m_ymTemplates; vector< vector > m_rTemplates; vector< vector > m_xmrTemplates; vector< vector > m_ymrTemplates; vector m_templateLengthVec; int m_totalResampleNum; bool m_enableTotalResample; vector m_curResampledPath; void setCurResampledPath(vector val) { m_curResampledPath = val; } private: }; } #endif // OneDollarRec_h__