Best way to display the skeleton from Kinect on an active PowerPoint-Presentation?
I display the skeleton from kinect on an active PowerPoint-Presenatation. My question is, is there a better way to do this, because it´s very slow and I think there could be a better solution :-)
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, (floa开发者_如何学JAVAt)handleft.X, (float)handleft.Y));
}
}
a performant solution is to put a window(form) in front of the presentation (alway on front) and stream/paint your data to this window.
精彩评论