Ejemplo n.º 1
0
    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);
         */
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
    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);
    }
Ejemplo n.º 5
0
    //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?
    }