public HandData(int id, Shape shape, Palm palm, IList<FingerPoint> fingerPoints) { this.id = id; this.shape = shape; this.palm = palm; this.fingerPoints = fingerPoints; }
public HandData(int id, Shape shape, Palm palm, IList <FingerPoint> fingerPoints) { this.id = id; this.shape = shape; this.palm = palm; this.fingerPoints = fingerPoints; }
private void FindCenterFromCandidates(IList <Point> contour, IList <Point> candidates) { double[] distances = new double[candidates.Count]; Parallel.For(0, candidates.Count, (index) => { distances[index] = FindMaxDistance(contour, candidates[index]); }); double maxDistance = this.result == null ? 0 : this.result.DistanceToContour; int maxIndex = -1; for (int index = 0; index < distances.Length; index++) { if (distances[index] > maxDistance) { maxDistance = distances[index]; maxIndex = index; } } if (maxIndex >= 0) { this.result = new Palm(candidates[maxIndex], maxDistance); } }
public Palm FindCenter(Contour contour, IList<Point> candidates) { this.result = null; var minimizedContour = new LineThinner(contourReduction, false).Filter(contour.Points); this.FindCenterFromCandidates(minimizedContour, candidates); this.IncreaseAccuracy(this.result.Location, minimizedContour); return result; }
private double FindMaxDistance(IList<Point> contourPoints, Point candidate) { double result = double.MaxValue; foreach (var point in contourPoints) { result = Math.Min(Point.Distance(point.X, point.Y, candidate.X, candidate.Y), result); } return result; }
public Palm FindCenter(Contour contour, IList <Point> candidates) { this.result = null; var minimizedContour = new LineThinner(contourReduction, false).Filter(contour.Points); this.FindCenterFromCandidates(minimizedContour, candidates); this.IncreaseAccuracy(this.result.Location, minimizedContour); return(result); }
private double FindMaxDistance(IList <Point> contourPoints, Point candidate) { double result = double.MaxValue; foreach (var point in contourPoints) { result = Math.Min(Point.Distance(point.X, point.Y, candidate.X, candidate.Y), result); } return(result); }
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); }
public Palm FindCenter(ConvexHull hull, Contour contour, IList<Point> candidates) { this.result = null; candidates = ReduceCandidatePoints(hull, candidates); if (candidates.Count > 0) { var minimizedContour = new LineThinner(contourReduction, false).Filter(contour.Points); this.FindCenterFromCandidates(minimizedContour, candidates); if (this.result != null) { this.IncreaseAccuracy(this.result.Location, minimizedContour); } } return result; }
public Palm FindCenter(ConvexHull hull, Contour contour, IList <Point> candidates) { this.result = null; candidates = ReduceCandidatePoints(hull, candidates); if (candidates.Count > 0) { var minimizedContour = new LineThinner(contourReduction, false).Filter(contour.Points); this.FindCenterFromCandidates(minimizedContour, candidates); if (this.result != null) { this.IncreaseAccuracy(this.result.Location, minimizedContour); } } return(result); }
private void FindCenterFromCandidates(IList<Point> contour, IList<Point> candidates) { double[] distances = new double[candidates.Count]; Parallel.For(0, candidates.Count, (index) => { distances[index] = FindMaxDistance(contour, candidates[index]); }); double maxDistance = this.result == null ? 0 : this.result.DistanceToContour; int maxIndex = -1; for (int index = 0; index < distances.Length; index++) { if (distances[index] > maxDistance) { maxDistance = distances[index]; maxIndex = index; } } if (maxIndex >= 0) { this.result = new Palm(candidates[maxIndex], maxDistance); } }
public static void DetectarCentroPalma(IList<Point> contour, IList<PointF> candidates) { double[] distances = new double[candidates.Count]; Parallel.For(0, candidates.Count, (index) => { distances[index] = FindMaxDistance(contour, candidates[index]); }); double maxDistance = result == null ? 0 : result.DistanceToContour; int maxIndex = -1; for (int index = 0; index < distances.Length; index++) { if (distances[index] > maxDistance) { maxDistance = distances[index]; maxIndex = index; } } if (maxIndex >= 0) { result = new Palm(candidates[maxIndex], maxDistance); } }