/// initializer. called after LoadFromFile is called public void Init(JointFeature pf) { if (m_posts == null) { throw new Exception("the PostureDetector members should be initialized first."); } m_postFeature = pf; m_fsm = new FSM(PostureCount, m_intervals, m_intvThres); m_fsm.m_thresMul = m_thresMulTimeIntv; m_isPostDet = new bool[PostureCount]; m_postFeature.RegisterJoints(m_jointIdx); // more initialization for the relative joint matcher for (int i = 0; i < PostureCount; i++) { for (int j = 0; j < m_posts[i].JointCount; j++) { m_posts[i][j].m_thresMul = m_thresMulPerPost[i] * m_thresMulPerJoint[j]; JointMatcherR jmr = m_posts[i][j] as JointMatcherR; if (jmr != null) { jmr.SetLastPostJoint(this, i, j); } } m_posts[i].Init(pf); // should be called after m_posts[i][j].m_thresMul is initialized } }
private GestureDetector InitTrain(string name, bool isUseRel) { m_tagCount = Mathf.Max(m_skRecorder.m_tagList.ToArray()); GestureDetector gd = new GestureDetector(); gd.m_name = name; gd.m_jointIdx = (Joint[])m_jointIdx.Clone(); gd.m_thresMulPerPost = new float[m_tagCount]; gd.m_thresMulPerJoint = new float[JointCount]; PostureDetector[] pd = new PostureDetector[m_tagCount]; gd.m_posts = pd; for (int i = 0; i < m_tagCount; i++) { gd.m_thresMulPerPost[i] = 1; pd[i] = new PostureDetector(); pd[i].m_name = name + '_' + (i + 1); JointMatcher[] jm = new JointMatcher[JointCount]; pd[i].m_jointMatcher = jm; for (int j = 0; j < JointCount; j++) { if (i == 0 || !isUseRel) { jm[j] = new JointMatcher(); } else { jm[j] = new JointMatcherR(); ((JointMatcherR)jm[j]).SetLastPostJoint(gd, i, j); } jm[j].m_jointIdx = m_jointIdx[j]; gd.m_thresMulPerJoint[j] = 1; } } return(gd); }