private void WriteDataFrame(CsvFileWriter writer, HI5_TransformInstance hand, GestureType gesture)
        {
            List <string> frame = new List <string>();

            foreach (var t in hand.HandBones)
            {
                if (recordPositions)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        frame.Add(t.localPosition[i].ToString());
                    }
                }
                for (int i = 0; i < 4; i++)
                {
                    frame.Add(t.localRotation[i].ToString());
                }
            }
            frame.Add(gesture.ToString());
            writer.WriteRow(frame);
            writer.Flush();
        }
Beispiel #2
0
    private void SendPositions(string handId, HI5_TransformInstance hand)
    {
        // send the quaternions of each finger.
        string[] coords        = { "X", "Y", "Z", "W" };
        object[] featureValues = new object[hand.HandBones.Length * 4];
        int      boneIndex     = 0;

        foreach (var t in hand.HandBones)
        {
            for (int i = 0; i < 4; i++)
            {
                featureValues[boneIndex * 4 + i] = (t.localRotation[i]);
            }

            boneIndex++;
        }

        //send the quaternion.
        OscMessage message = new OscMessage("/predict", handId, featureValues);

        sender.Send(message);
    }
        private void WriteHeader(CsvFileWriter writer, HI5_TransformInstance hand)
        {
            List <string> header = new List <string>();

            string[] coords = { "X", "Y", "Z", "W" };
            foreach (var t in hand.HandBones)
            {
                if (recordPositions)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        header.Add(string.Format("{0}_Pos_{1}", t.name, coords[i]));
                    }
                }
                for (int i = 0; i < 4; i++)
                {
                    header.Add(string.Format("{0}_Quat_{1}", t.name, coords[i]));
                }
            }
            header.Add("Gesture");
            writer.WriteRow(header);
            writer.Flush();
        }