Пример #1
0
 public HandData(int id, Shape shape, Palm palm, IList<FingerPoint> fingerPoints)
 {
     this.id = id;
     this.shape = shape;
     this.palm = palm;
     this.fingerPoints = fingerPoints;
 }
Пример #2
0
        private HandData Create(int id, Shape shape, IList<FingerPoint> lastFrameFingerPoints)
        {
            var newFingerPoints = this.DetectFingerPoints(shape.ConvexHull, shape.Contour);
            var fingerPoints = this.MapFingerPoints(lastFrameFingerPoints, newFingerPoints);
            var palm = DetectPalm(shape, shape.Contour);

            if (settings.DetectFingerDirection) {
                this.fingerBaseDetector.Detect(shape.Contour, fingerPoints);
            }

            return new HandData(id, shape, palm, fingerPoints.Where(f => f.FrameCount >= this.settings.FramesForNewFingerPoint).ToList()) { NewlyDetectedFingerPoints = fingerPoints.Where(f => f.FrameCount < this.settings.FramesForNewFingerPoint).ToList() };
        }
Пример #3
0
 private HandData Create(HandData lastFrameData, Shape shape)
 {
     return this.Create(lastFrameData.Id, shape, lastFrameData.FingerPoints.Union(lastFrameData.NewlyDetectedFingerPoints).ToList());
 }
Пример #4
0
 private HandData Create(Shape shape)
 {
     return this.Create(idGenerator.GetNextId(), shape, new List<FingerPoint>());
 }
Пример #5
0
        private Palm DetectPalm(Shape shape, Contour contour)
        {
            var candidates = shape.Points;
            Palm palm = null;

            if (this.settings.DetectCenterOfPalm && shape.PointCount > 0 && contour.Count > 0) {
                palm = this.palmFinder.FindCenter(shape.ConvexHull, contour, shape.Points);
            }
            return palm;
        }