public HandData(int id, Shape shape, Palm palm, IList<FingerPoint> fingerPoints) { this.id = id; this.shape = shape; this.palm = palm; this.fingerPoints = fingerPoints; }
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() }; }
private HandData Create(HandData lastFrameData, Shape shape) { return this.Create(lastFrameData.Id, shape, lastFrameData.FingerPoints.Union(lastFrameData.NewlyDetectedFingerPoints).ToList()); }
private HandData Create(Shape shape) { return this.Create(idGenerator.GetNextId(), shape, new List<FingerPoint>()); }
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; }