Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I would like to transform the depth data from the entire scene of the view of the camera to point cloud.At this time i track and import only the human skeleton from the depth data.If someone could help me i would be grateful.

Here is the code:


C#
// we got all frames
                if (multiSourceFrameProcessed && depthFrameProcessed && bodyIndexFrameProcessed)
                {
                    StringBuilder sb = new StringBuilder();
                    int len = 0;

                    //   this.coordinateMapper.MapDepthFrameToColorSpace(this.depthFrameData, this.colorPoints);
                    this.coordinateMapper.MapDepthFrameToCameraSpace(this.depthFrameData, this.cameraPoints);

                    // loop over each row and column of the depth
                    for (int y = 0; y < depthHeight; y += step)
                    {
                        for (int x = 0; x < depthWidth; x += step)
                        {

                            // calculate index into depth array
                            int depthIndex = (y * depthWidth) + x;

                            byte player = this.bodyIndexFrameData[depthIndex];

                            // if we're tracking a player for the current pixel, sets its color and alpha to full
                            if (player != 0xff)
                            {

                                //ty = ty + 1;
                                CameraSpacePoint p = this.cameraPoints[depthIndex];

                                // retrieve the depth to color mapping for the current depth pixel
                                //      ColorSpacePoint colorPoint = this.colorPoints[depthIndex];

                                // make sure the depth pixel maps to a valid point in color space


                                if (!(Double.IsInfinity(p.X)) && !(Double.IsInfinity(p.Y)) && !(Double.IsInfinity(p.Z)))
                                {
                                    sb.Append(String.Format(CultureInfo.InvariantCulture, "{0} {1} {2}  \n", p.X, p.Y, p.Z));


                                    if (this.NewPointEvent != null)
                                    {

                                        this.NewPointEvent(this, new NewPointEventArgs(p.X, p.Y, p.Z));
                                        len++;

                                    }
                                }




                            }
                        }


                    }
                }

/p.X,p.Y,p.Z are x-y-z position of human skeleton

What I have tried:

tutorials for point cloud and depth data
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900