public void OpenSkeleton(string path) { using (CsvFileReader reader = new CsvFileReader(path)) { sktList = new List<MySkeleton>(); CsvRow row = new CsvRow(); // one frame skeleton while (reader.ReadRow(row)) { var skt = new MySkeleton(14); if (row[0].ToLower().Trim().Equals("untracked")) { skt.Tracked = false; } else { int step = 7; // one joint for (int i = 0; i < row.Count; i += step) { var type = i / step; var joint = new MyJoint() { Pos3D = new SkeletonPoint() { X = Convert.ToSingle(row[i]), Y = Convert.ToSingle(row[i + 1]), Z = Convert.ToSingle(row[i + 2]) }, PosColor = new System.Drawing.Point() { X = (int)Convert.ToSingle(row[i + 3]), Y = (int)Convert.ToSingle(row[i + 4]) }, PosDepth = new System.Drawing.Point() { X = (int)Convert.ToSingle(row[i + 5]), Y = (int)Convert.ToSingle(row[i + 6]) } }; skt[type] = joint; } } sktList.Add(skt); } } //foreach (var mySkeleton in sktList) //{ // Console.Write(mySkeleton[MyJointType.Head].PosColor.X); //} }
public MySkeleton(int count = 20) { Joints = new MyJoint[20]; Tracked = true; }