public void AddTemplate(ReplaySkeletonData skeleton) { RecordedPath recordedPath = new RecordedPath(skeleton.Joints.Count); recordedPath.Points.AddRange(skeleton.Joints.ToListOfVector2()); LearningMachine.AddPath(recordedPath); }
public ReplaySkeletonFrame(SkeletonFrame frame) { FloorClipPlane = frame.FloorClipPlane; FrameNumber = frame.FrameNumber; NormalToGravity = frame.NormalToGravity; Quality = frame.Quality; TimeStamp = frame.TimeStamp; Skeletons = new ReplaySkeletonData[frame.Skeletons.Length]; for (int index = 0; index < Skeletons.Length; index++) { Skeletons[index] = frame.Skeletons[index]; } }
internal ReplaySkeletonFrame(BinaryReader reader, int frameNumber) { TimeStamp = reader.ReadInt64(); FloorClipPlane = reader.ReadVector(); Quality = (SkeletonFrameQuality)reader.ReadInt32(); NormalToGravity = reader.ReadVector(); FrameNumber = frameNumber; int skeletonsCount = reader.ReadInt32(); Skeletons = new ReplaySkeletonData[skeletonsCount]; for (int index = 0; index < skeletonsCount; index++) { Skeletons[index] = new ReplaySkeletonData(reader); } }
internal ReplaySkeletonFrame(BinaryReader reader, int frameNumber) { TimeStamp = reader.ReadInt64(); FloorClipPlane = reader.ReadVector(); Quality = (SkeletonFrameQuality) reader.ReadInt32(); NormalToGravity = reader.ReadVector(); FrameNumber = frameNumber; int skeletonsCount = reader.ReadInt32(); Skeletons = new ReplaySkeletonData[skeletonsCount]; for (int index = 0; index < skeletonsCount; index++) { Skeletons[index] = new ReplaySkeletonData(reader); } }
public override void TrackPostures(ReplaySkeletonData skeleton) { if (skeleton.TrackingState != SkeletonTrackingState.Tracked) return; Vector3? headPosition = null; Vector3? leftHandPosition = null; Vector3? rightHandPosition = null; foreach (Joint joint in skeleton.Joints) { if (joint.Position.W < 0.8f || joint.TrackingState != JointTrackingState.Tracked) continue; switch (joint.ID) { case JointID.Head: headPosition = joint.Position.ToVector3(); break; case JointID.HandLeft: leftHandPosition = joint.Position.ToVector3(); break; case JointID.HandRight: rightHandPosition = joint.Position.ToVector3(); break; } } if (AreHandsJoined(leftHandPosition, rightHandPosition)) { RaisePostureDetected("CombatPosture"); return; } Reset(); }
public override void TrackPostures(ReplaySkeletonData skeleton) { if (skeleton.TrackingState != SkeletonTrackingState.Tracked) return; Vector3? headPosition = null; Vector3? leftHandPosition = null; Vector3? rightHandPosition = null; foreach (Joint joint in skeleton.Joints) { if (joint.Position.W < 0.8f || joint.TrackingState != JointTrackingState.Tracked) continue; switch (joint.ID) { case JointID.Head: headPosition = joint.Position.ToVector3(); break; case JointID.HandLeft: leftHandPosition = joint.Position.ToVector3(); break; case JointID.HandRight: rightHandPosition = joint.Position.ToVector3(); break; } } // HandsJoined if (CheckHandsJoined(rightHandPosition, leftHandPosition)) return; // LeftHandOverHead if (CheckHandOverHead(headPosition, leftHandPosition)) { RaisePostureDetected("LeftHandOverHead"); return; } // RightHandOverHead if (CheckHandOverHead(headPosition, rightHandPosition)) { RaisePostureDetected("RightHandOverHead"); return; } // LeftHello if (CheckHello(headPosition, leftHandPosition)) { RaisePostureDetected("LeftHello"); return; } // RightHello if (CheckHello(headPosition, rightHandPosition)) { RaisePostureDetected("RightHello"); return; } Reset(); }
public abstract void TrackPostures(ReplaySkeletonData skeleton);
public override void TrackPostures(ReplaySkeletonData skeleton) { if (LearningMachine.Match(skeleton.Joints.ToListOfVector2(), Epsilon, MinimalScore, MinimalSize)) RaisePostureDetected(postureName); }