public void ProcessEvent(XEFEvent ev) { if (ev.EventStreamDataTypeId != StreamDataTypeIds.Body) { return; } // Update start/end time if (!_seenEvent) { StartTime = ev.RelativeTime; _seenEvent = true; } EndTime = ev.RelativeTime; // Get raw body data XEFBodyFrame bodyFrame = XEFBodyFrame.FromByteArray(ev.EventData); // Write floor plane data XEFVector floorClipPlane = bodyFrame.FloorClipPlane; _writer.Write("{0},{1}", ev.EventIndex, ev.RelativeTime.Ticks); _writer.Write(",{0},{1},{2},{3}", floorClipPlane.x, floorClipPlane.y, floorClipPlane.z, floorClipPlane.w); _writer.WriteLine(); EventCount++; }
public void ProcessEvent(XEFEvent ev) { if (ev.EventStreamDataTypeId != StreamDataTypeIds.Body) { return; } // Update start/end time if (!_seenEvent) { StartTime = ev.RelativeTime; _seenEvent = true; } EndTime = ev.RelativeTime; // Get raw body data XEFBodyFrame bodyFrame = XEFBodyFrame.FromByteArray(ev.EventData); for (int i = 0; i < bodyFrame.BodyData.Length; i++) { XEFBodyData body = bodyFrame.BodyData[i]; if (body.TrackingState == XEFBodyTrackingState.TRACKED) { // Write skeleton body _writer.Write("{0},{1},{2}", ev.EventIndex, ev.RelativeTime.Ticks, body.TrackingID); _writer.Write(",{0},{1}", body.HandDataLeft.HandConfidence, body.HandDataLeft.HandState); _writer.Write(",{0},{1}", body.HandDataRight.HandConfidence, body.HandDataRight.HandState); // Enumerate all joints foreach (XEFJointType jointType in Enum.GetValues(typeof(XEFJointType))) { // Write skeleton joint XEFTrackingState jointTrackingState = body.SkeletonJointPositionTrackingStates[jointType]; XEFVector jointPosition = body.SkeletonJointPositions[jointType]; XEFVector jointOrientation = body.SkeletonJointOrientations[jointType]; _writer.Write(",{0},{1},{2},{3},{4}", jointType, jointTrackingState, jointPosition.x, jointPosition.y, jointPosition.z); _writer.Write(",{0},{1},{2},{3}", jointOrientation.w, jointOrientation.x, jointOrientation.y, jointOrientation.z); } _writer.WriteLine(); } } EventCount++; }