Inheritance: ILocatable
コード例 #1
0
ファイル: HandData.cs プロジェクト: an83/KinectTouch2
 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)
            {
                new FingerBaseDetector().Detect(shape.Contour, fingerPoints);
            }

            return new HandData(id, shape, palm, fingerPoints);
        }
コード例 #3
0
 private HandData Create(HandData lastFrameData, Shape shape)
 {
     return this.Create(lastFrameData.Id, shape, lastFrameData.FingerPoints);
 }
コード例 #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(contour, shape.Points);
            }
            return palm;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
 private HandData Create(HandData lastFrameData, Shape shape)
 {
     return this.Create(lastFrameData.Id, shape, lastFrameData.FingerPoints.Union(lastFrameData.NewlyDetectedFingerPoints).ToList());
 }
コード例 #8
0
        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;
        }