/// format the real time gesture data to strings
    private void GenerateGestureDataString()
    {
        m_showStr = "";
        string          stateStr = "Key frame detect: ";
        GestureDetector gestDet  = m_manager[m_gestIdx];

        for (int i = 0; i < gestDet.JointCount; i++)
        {
            Joint   j   = gestDet.m_jointIdx[i];
            Vector3 vec = m_manager.m_postFeature.m_jointVec[(int)j];
            m_showStr += string.Format("{0}: {1}\n", j.ToString(), vec.ToString());
        }
        m_showStr += '\n';

        m_showStr += "Gesture name: " + m_manager[m_gestIdx].m_name + " (use left/right arrow key to switch)\n";
        m_showStr += "Matching score of joints in next key posture: \n";
        int g = gestDet.CurState;

        //for(int i = 0; i < gestDet.PostureCount; i++) // if all postures are showed, they must be all updated in GestureDetector.Detect()
        // or we only show the info for the next posture of gestDet[g]
        //{
        m_showStr += gestDet[g].m_name + ": ";
        for (int j = 0; j < gestDet.JointCount; j++)
        {
            m_showStr += string.Format(" {0:F2},", gestDet[g].JointScore[j]);
        }
        m_showStr += "\n";
        stateStr  += Convert.ToByte(gestDet.IsPostDet[g]) + ",";
        //}
        m_showStr += string.Format("State: {0}, {1:F3}s\n", gestDet.Fsm.m_state, gestDet.Fsm.m_stateContTime);
        m_showStr += stateStr + (gestDet.IsDetected ? "Bingo!" : "");
    }
Esempio n. 2
0
    /// generate strings for UIInfoObserver
    public void GetObserverString(out string strData, out string strFrame)
    {
        strData = "Joint info\n";
        if (m_skRecorder.FrameCount > 0)
        {
            JointData[] jda = m_skRecorder.m_dataList[m_curFrame];
            for (int i = 0; i < m_skRecorder.JointCount; i++)
            {
                Joint   j   = m_skRecorder.m_jointIdx[i];
                Vector3 vec = jda[i].m_pos;
                strData += string.Format("{0}: {1}\n", j.ToString(), vec.ToString());
            }

            strData += string.Format("\nFrame {0}/{1}, time {2} s\n", m_curFrame + 1, m_skRecorder.FrameCount, m_skRecorder.m_timeList[m_curFrame]);
            if (m_skRecorder.m_tagList[m_curFrame] != 0)
            {
                strData += string.Format("key frame tag {0}", m_skRecorder.m_tagList[m_curFrame]);
            }
        }

        strFrame = m_strFrame;
    }