public void OnNewFrame(Astra.BodyStream bodyStream, Astra.BodyFrame frame) { if (frame.Width == 0 || frame.Height == 0) { return; } if (_lastFrameIndex == frame.FrameIndex) { return; } _lastFrameIndex = frame.FrameIndex; frame.CopyBodyData(ref _bodies); UpdateSkeletonsFromBodies(_bodies); DestroyAbsentBodies(); /* * UpdateBodyFeatures(bodyStream, _bodies); * UpdateSkeletonProfile(bodyStream); * UpdateSkeletonOptimization(bodyStream); */ }
public void OnNewFrame(Astra.BodyStream bodyStream, Astra.BodyFrame frame) { if (frame.Width == 0 || frame.Height == 0) { return; } // Measure time since last body update float time = Time.realtimeSinceStartup; float delta = time - lastBodyUpdateTime; lastBodyUpdateTime = time; bodyUpdateDeltaTime = (0.1f * delta + 0.9f * bodyUpdateDeltaTime); _bodyUpdateFps = (int)(1.0f / bodyUpdateDeltaTime); }
public void Update(Astra.BodyFrame bodyFrame) { // Is compatible? if (bodyFrame == null || bodyFrame.Width != depthWidth || bodyFrame.Height != depthHeight) { return; } // 1st step: get information about bodies lock (bodies) { bodyFrame.CopyBodyData(ref bodies); } // 2nd step: we can update ImageSource only from its owner thread (as a rule, UI thread) dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(DrawBodies)); }
public void OnNewFrame(Astra.BodyStream bodyStream, Astra.BodyFrame frame) { if (frame.Width == 0 || frame.Height == 0) { return; } if (_lastFrameIndex == frame.FrameIndex) { return; } _lastFrameIndex = frame.FrameIndex; frame.CopyBodyData(ref _bodies); UpdateSkeletonsFromBodies(_bodies); }
//TODO: Handle bodymask here aswell to increase performance? public void OnNewFrame(Astra.BodyStream bodyStream, Astra.BodyFrame frame) { if (frame.Width == 0 || frame.Height == 0) { return; } //should already be checked in function that calls this //if (_lastFrameIndex == frame.FrameIndex) //{ // return; //} _lastFrameIndex = frame.FrameIndex; //bodyStream. frame.CopyBodyData(ref _bodies); UpdateSkeletonsFromBodies(_bodies); UpdateBodyFeatures(bodyStream, _bodies); //needed? UpdateSkeletonProfile(bodyStream); //needed? }