ToWorldDepth() публичный статический Метод

public static ToWorldDepth ( double depth ) : int
depth double
Результат int
Пример #1
0
        public static SkeletonPoint DepthToSkeleton(Rectangle rect, byte[,,] depthData, int width,
                                                    int height, CoordinateConverter mapper)
        {
            var aveDepth = 0.0;
            var count    = 0;

            for (int y = rect.Top; y < rect.Top + rect.Height && y < height; y++)
            {
                for (int x = rect.Left; x < rect.Left + rect.Width && x < width; x++)
                {
                    if (x > 0 && y > 0)
                    {
                        aveDepth += depthData[y, x, 0];
                        count++;
                    }
                }
            }

            var depth   = PlayerDetector.ToWorldDepth(aveDepth / count);
            var center  = rect.Center();
            var centerX = Math.Max(0, center.X);

            centerX = Math.Min(centerX, width);
            var centerY = Math.Max(0, center.Y);

            centerY = Math.Min(centerY, height);
            return(mapper.MapDepthPointToSkeletonPoint((int)centerX, (int)centerY, depth));
        }