首页 文章

深度图像的Kinect骨架算法

提问于
浏览
2

我很好奇是否可以使用Kinect传感器的骨架算法 .

更具体我有一些深度图像,我想提取骨架 . 可能吗?

2 回答

  • 0

    对的,这是可能的 .

    但可能,这并不简单 .

    允许骨架跟踪的算法称为“ Single Depth Image 部件中的实时人体姿势识别” . 换句话说,它已经被用来从一个单一深度图像估计骨骼关节,这就是你需要的 .

    使用SDK(如Microsoft,或您喜欢的任何其他)的优点是您不需要重新实现骨架跟踪算法 . 实际上,它非常复杂,还需要大量的人工创建和正确使用的培训数据 .

    但是,如果您想了解更多信息,可以在this page找到所需的一切,其中有一个指向original paper的链接和一些关于构建用于实现算法的训练数据集的supplementary material .

  • 2

    要使用Kinect跟踪骨架,您必须启用SkeletonStream并获取其中包含骨架信息的帧(而不是从深度帧获取信息 . 它们内部不存储骨架信息) .

    首先,您必须在应用程序中启用骨架流,就像使用深度流或颜色流一样(我假设您已了解,因为您已经拥有深度图像) .

    sensor.SkeletonStream.Enable(new TransformSmoothParameters() 
                {
                    Smoothing = 0.5f,
                    Correction = 0.5f,
                    Prediction = 0.5f,
                    JitterRadius = 0.5f,
                    MaxDeviationRadius = 0.04f
    
                });; // enable the skeleton stream, you could essentially not include any of the content in between the first and last curved brackets, as they are mainly used to stabilize the skeleton information (e.g. predict where a joint is if it disappears)
    
    skeletonData = new Skeleton[kinect.SkeletonStream.FrameSkeletonArrayLength]; // this array will hold your skeletal data and is equivalent to the short array that holds your depth data.
    
    sensor.SkeletonFrameReady += this.SkeletonFrameReady;
    

    然后你必须有一个方法,每当Kinect有一个框架要显示(一个包含所有骨架信息的框架)时,就会触发该方法

    private void SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) 
    {
         using (SkeletonFrame skeletonFrame = e.SkeletonFrame()) //get all the skeleton data
         {
         if (skeletonFrame == null) //if there's no data, then exit
                {
                    return;
                }
    
                skeletonFrame.CopySkeletonDataTo(skeletonData); //copy all the skeleton data into our skeleton array. It's an array that holds data for up to 6 skeletons
    
                Skeleton skeletonOfInterest = (from s in skeletonData
                                  where s.TrackingState == SkeletonTrackingState.Tracked
                                  select s).ElementAtOrDefault(1); //define the first skeleton thats tracked
    
               //put code to manipulate skeletons. You have to go do some reading to find out how to work with the skeletons.
         }
    }
    

    MSDN通常是我学习如何使用Kinect的goto资源 . 如果您安装了Kinect SDK,那么Developer Toolkit浏览器中也有一些很好的示例 . 最后,Apress的另一个好资源是 Beginning Kinect Programming with the Microsoft Kinect SDK ,我已经广泛依赖了它 . 你可以在Amazon找到它 .

相关问题