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) { new FingerBaseDetector().Detect(shape.Contour, fingerPoints); } return new HandData(id, shape, palm, fingerPoints); }
private HandData Create(HandData lastFrameData, Shape shape) { return this.Create(lastFrameData.Id, shape, lastFrameData.FingerPoints); }
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(contour, shape.Points); } return palm; }
private HandData Create(int id, Shape shape, IList<FingerPoint> lastFrameFingerPoints) { var newFingerPoints = this.DetectFingerPoints(shape); var fingerPoints = this.MapFingerPoints(lastFrameFingerPoints, newFingerPoints); var palm = DetectPalm(shape, shape.Contour); if (settings.DetectFingerDirection) { this.fingerBaseDetector.Detect(shape.Contour, fingerPoints); } var handData = new HandData(id, shape, palm, fingerPoints.Where(f => f.FrameCount >= this.settings.FramesForNewFingerPoint).ToList()) { NewlyDetectedFingerPoints = fingerPoints.Where(f => f.FrameCount < this.settings.FramesForNewFingerPoint).ToList() }; return handData; }
private HandData Create(HandData lastFrameData, Shape shape) { return this.Create(lastFrameData.Id, shape, lastFrameData.FingerPoints.Union(lastFrameData.NewlyDetectedFingerPoints).ToList()); }
private IList<FingerPoint> DetectFingerPoints(Shape shape) { if (!this.settings.DetectFingers) { return new List<FingerPoint>(); } var result = this.fingerPointDetector.FindFingerPoints(shape.Contour, shape.ConvexHull) .Where(i => i.Location.Y <= shape.Location.Y).ToList(); return result; }