我在活动的 PowerPoint 演示文稿上显示来自 kinect 的骨架。我的问题是,有没有更好的方法来做到这一点,因为它非常慢,我认为可能有更好的解决方案:-)
List<Shape> shape = new List<Shape>();
foreach (SkeletonData data in skeletonFrame.Skeletons)
{
if (SkeletonTrackingState.Tracked == data.TrackingState)
{
//get the actual slide
Slide slide = Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow.View.Slide;
//delete old shapes (lines)
shape.ForEach(s => s.Delete());
shape.Clear();
//get new points
Point head = getDisplayPosition(data.Joints[JointID.Head]);
Point shoulder = getDisplayPosition(data.Joints[JointID.ShoulderCenter]);
Point shoulderleft = getDisplayPosition(data.Joints[JointID.ShoulderLeft]);
Point shoulderright = getDisplayPosition(data.Joints[JointID.ShoulderRight]);
Point elbowright = getDisplayPosition(data.Joints[JointID.ElbowRight]);
Point elbowleft = getDisplayPosition(data.Joints[JointID.ElbowLeft]);
Point wristright = getDisplayPosition(data.Joints[JointID.WristRight]);
Point wristleft = getDisplayPosition(data.Joints[JointID.WristLeft]);
Point handright = getDisplayPosition(data.Joints[JointID.HandRight]);
Point handleft = getDisplayPosition(data.Joints[JointID.HandLeft]);
//add new shapes (lines)
shape.Add(slide.Shapes.AddShape(MsoAutoShapeType.msoShapeCloud,(float)head.X, (float)head.Y, 10, 10));
shape.Add(slide.Shapes.AddLine((float)head.X, (float)head.Y, (float)shoulder.X, (float)shoulder.Y));
shape.Add(slide.Shapes.AddLine((float)shoulder.X, (float)shoulder.Y, (float)shoulderright.X, (float)shoulderright.Y));
shape.Add(slide.Shapes.AddLine((float)shoulderright.X, (float)shoulderright.Y, (float)elbowright.X, (float)elbowright.Y));
shape.Add(slide.Shapes.AddLine((float)elbowright.X, (float)elbowright.Y, (float)wristright.X, (float)wristright.Y));
shape.Add(slide.Shapes.AddLine((float)wristright.X, (float)wristright.Y, (float)handright.X, (float)handright.Y));
shape.Add(slide.Shapes.AddLine((float)shoulder.X, (float)shoulder.Y, (float)shoulderleft.X, (float)shoulderleft.Y));
shape.Add(slide.Shapes.AddLine((float)shoulderleft.X, (float)shoulderleft.Y, (float)elbowleft.X, (float)elbowleft.Y));
shape.Add(slide.Shapes.AddLine((float)elbowleft.X, (float)elbowleft.Y, (float)wristleft.X, (float)wristleft.Y));
shape.Add(slide.Shapes.AddLine((float)wristleft.X, (float)wristleft.Y, (float)handleft.X, (float)handleft.Y));
}
}