Accord.Controls.Vision.FaceController.computeCurrentPosition C# (CSharp) Method

computeCurrentPosition() private method

private computeCurrentPosition ( int width, int height ) : void
width int
height int
return void
        private void computeCurrentPosition(int width, int height)
        {
            TrackingObject obj = tracker.TrackingObject;

            DoubleRange scaleX = new DoubleRange(0, width);
            DoubleRange scaleY = new DoubleRange(0, height);
            DoubleRange unit = new DoubleRange(-1, 1);

            this.rawX = (float)Vector.Scale(obj.Center.X, scaleX, unit);
            this.rawY = (float)Vector.Scale(obj.Center.Y, scaleY, unit);

            double newPositionX = Vector.Scale(rawX, xaxisRange, unit);
            double newPositionY = Vector.Scale(rawY, yaxisRange, unit);

            xsmooth.Push(newPositionX);
            ysmooth.Push(newPositionY);

            newPositionX = xsmooth.Mean;
            newPositionY = ysmooth.Mean;

            this.currentX = (float)(Math.Round(newPositionX, 1));
            this.currentY = (float)(Math.Round(newPositionY, 1));
        }
        #endregion