2011-08-17 79 views
1

我在有效的PowerPoint演示文稿中顯示來自kinect的骨架。我的問題是,有沒有更好的方式來做到這一點,因爲it's非常緩慢,我認爲有可能是一個更好的解決方案:-)在活動的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)); 
    } 
} 

回答

0

一個高性能的解決方案是把一個窗口(形式) (前面總是),並將數據流/繪製到此窗口。

相關問題