Пример #1
0
        private void FindBasePoints(Contour contour, FingerPoint fingerPoint)
        {
            var fingerPointIndex = FindIndex(fingerPoint.Fingertip, contour);
            var distanceAdjustedOffset = (int)(offsetDistance * indexOffset / fingerPoint.Fingertip.Z);

            fingerPoint.BaseLeft = contour.GetPointAt(Rollover(fingerPointIndex - distanceAdjustedOffset, contour.Count));
            fingerPoint.BaseRight = contour.GetPointAt(Rollover(fingerPointIndex + distanceAdjustedOffset, contour.Count));

            var baseCenter = Point.Center(fingerPoint.BaseLeft, fingerPoint.BaseRight);
            fingerPoint.DirectionVector = Point.Subtract(fingerPoint.Fingertip, baseCenter).GetNormalizedVector();
        }
Пример #2
0
        private void FindBasePoints(Contour contour, FingerPoint fingerPoint)
        {
            var fingerPointIndex       = FindIndex(fingerPoint.Fingertip, contour);
            var distanceAdjustedOffset = (int)(offsetDistance * indexOffset / fingerPoint.Fingertip.Z);

            fingerPoint.BaseLeft  = contour.GetPointAt(Rollover(fingerPointIndex - distanceAdjustedOffset, contour.Count));
            fingerPoint.BaseRight = contour.GetPointAt(Rollover(fingerPointIndex + distanceAdjustedOffset, contour.Count));

            var baseCenter = Point.Center(fingerPoint.BaseLeft, fingerPoint.BaseRight);

            fingerPoint.DirectionVector = Point.Subtract(fingerPoint.Fingertip, baseCenter).GetNormalizedVector();
        }
Пример #3
0
        private void PaintFingerPoint(FingerPoint point, DrawingContext drawingContext)
        {
            drawingContext.DrawEllipse(Brushes.Red, null, new System.Windows.Point(point.X, point.Y), 5.5, 5.5);
            drawingContext.DrawEllipse(Brushes.Orange, null, new System.Windows.Point(point.BaseLeft.X, point.BaseLeft.Y), 5.5, 5.5);
            drawingContext.DrawEllipse(Brushes.Orange, null, new System.Windows.Point(point.BaseRight.X, point.BaseRight.Y), 5.5, 5.5);

            if (!ParaIF.Core.Struct.Point.IsZero(point.BaseLeft) && !ParaIF.Core.Struct.Point.IsZero(point.BaseRight)) {
                var baseCenter = ParaIF.Core.Struct.Point.Center(point.BaseLeft, point.BaseRight);

                drawingContext.DrawLine(this.orangePen, new System.Windows.Point(baseCenter.X, baseCenter.Y), new System.Windows.Point(point.X + point.DirectionVector.X * 60, point.Y + point.DirectionVector.Y * 60));
            }
        }