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)); }
void Init(int width, int height, int bufferSize) { this.width = width; this.height = height; this.bufferSize = bufferSize; // Diff at t - 0; DiffMask0 = new Image<Gray, Byte>(width, height); DiffMask1 = new Image<Gray, Byte>(width, height); SaliencyProb = new Image<Gray, Single>(width, height); Diff0 = new Image<Gray, Byte>(width, height); smoothedDepth = new Image<Gray, Byte>(width, height); prevSmoothedDepth = new Image<Gray, Byte>(width, height); TempMask = new Image<Gray, Byte>(width, height); TemporalSmoothed = new Image<Gray, Single>(width, height); diffCumulativeDist = new float[NumBin]; depthCumulativeDist = new float[NumBin]; playerDetector = new PlayerDetector(width, height, mapper, bufferSize); PrevBoundingBoxes = new List<Rectangle>(); if (bufferSize <= 1) TrackedDepthFrame = smoothedDepth; else TrackedDepthFrame = prevSmoothedDepth; }
void Init(int width, int height) { this.width = width; this.height = height; playerDetector = new PlayerDetector(width, height, mapper); imageStorage = new byte[height, width, 3]; Gray = new Image<Gray, byte>(width, height); smallGray = new Image<Gray, byte>(width / ImageScale, height / ImageScale); SmoothedDepth = new Image<Gray, byte>(width, height); InterestPoints = new List<Point>(); }
void Init(int width, int height) { this.width = width; this.height = height; playerDetector = new PlayerDetector(width, height, mapper); SmoothedDepth = new Image<Gray, byte>(width, height); }