Beispiel #1
0
 public void Filter(SkeletonBuilder skeleton)
 {
     foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
     {
         if (minutia.Ridges.Count == 1 && minutia.Ridges[0].End.Ridges.Count >= 3)
         {
             if (minutia.Ridges[0].Points.Count < MinTailLength)
             {
                 minutia.Ridges[0].Detach();
             }
         }
     }
     DotRemover.Filter(skeleton);
     KnotRemover.Filter(skeleton);
     Logger.Log(skeleton);
 }
Beispiel #2
0
 public void FixLinkingGaps(SkeletonBuilder skeleton)
 {
     foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
     {
         foreach (SkeletonBuilder.Ridge ridge in minutia.Ridges)
         {
             if (ridge.Points[0] != minutia.Position)
             {
                 Point[] filling = Calc.ConstructLine(ridge.Points[0], minutia.Position);
                 for (int i = 1; i < filling.Length; ++i)
                 {
                     ridge.Reversed.Points.Add(filling[i]);
                 }
             }
         }
     }
 }
Beispiel #3
0
        public void Filter(SkeletonBuilder skeleton)
        {
            List <SkeletonBuilder.Minutia> removed = new List <SkeletonBuilder.Minutia>();

            foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
            {
                if (minutia.Ridges.Count == 0)
                {
                    removed.Add(minutia);
                }
            }
            foreach (SkeletonBuilder.Minutia minutia in removed)
            {
                skeleton.RemoveMinutia(minutia);
            }
            Logger.Log(skeleton);
        }
Beispiel #4
0
 public void Draw(SkeletonBuilder skeleton, BinaryMap binary)
 {
     foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
     {
         binary.SetBitOne(minutia.Position);
         foreach (SkeletonBuilder.Ridge ridge in minutia.Ridges)
         {
             if (ridge.Start.Position.Y <= ridge.End.Position.Y)
             {
                 foreach (Point point in ridge.Points)
                 {
                     binary.SetBitOne(point);
                 }
             }
         }
     }
 }
Beispiel #5
0
        public Size GetSize(SkeletonBuilder skeleton)
        {
            RectangleC rect = new RectangleC(0, 0, 1, 1);

            foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
            {
                rect.Include(minutia.Position);
                foreach (SkeletonBuilder.Ridge ridge in minutia.Ridges)
                {
                    if (ridge.Start.Position.Y <= ridge.End.Position.Y)
                    {
                        foreach (Point point in ridge.Points)
                        {
                            rect.Include(point);
                        }
                    }
                }
            }
            return(rect.Size);
        }
Beispiel #6
0
        public void Filter(SkeletonBuilder skeleton)
        {
            PriorityQueueF <Gap> queue = new PriorityQueueF <Gap>();

            foreach (SkeletonBuilder.Minutia end1 in skeleton.Minutiae)
            {
                if (end1.Ridges.Count == 1 && end1.Ridges[0].Points.Count >= MinEndingLength)
                {
                    foreach (SkeletonBuilder.Minutia end2 in skeleton.Minutiae)
                    {
                        if (end2 != end1 && end2.Ridges.Count == 1 && end1.Ridges[0].End != end2 &&
                            end2.Ridges[0].Points.Count >= MinEndingLength && IsWithinLimits(end1, end2))
                        {
                            Gap gap;
                            gap.End1 = end1;
                            gap.End2 = end2;
                            queue.Enqueue(Calc.DistanceSq(end1.Position, end2.Position), gap);
                        }
                    }
                }
            }

            BinaryMap shadow = SkeletonShadow.Draw(skeleton);

            while (queue.Count > 0)
            {
                Gap gap = queue.Dequeue();
                if (gap.End1.Ridges.Count == 1 && gap.End2.Ridges.Count == 1)
                {
                    Point[] line = Calc.ConstructLine(gap.End1.Position, gap.End2.Position);
                    if (!IsOverlapping(line, shadow))
                    {
                        AddRidge(skeleton, shadow, gap, line);
                    }
                }
            }

            KnotRemover.Filter(skeleton);
            Logger.Log(skeleton);
        }
Beispiel #7
0
        public object Clone()
        {
            SkeletonBuilder clone = new SkeletonBuilder();

            Dictionary <Minutia, Minutia> minutiaClones = new Dictionary <Minutia, Minutia>();

            foreach (Minutia minutia in AllMinutiae)
            {
                Minutia minutiaClone = new Minutia(minutia.Position);
                minutiaClone.Valid = minutia.Valid;
                clone.AddMinutia(minutiaClone);
                minutiaClones[minutia] = minutiaClone;
            }

            Dictionary <Ridge, Ridge> ridgeClones = new Dictionary <Ridge, Ridge>();

            foreach (Minutia minutia in AllMinutiae)
            {
                foreach (Ridge ridge in minutia.Ridges)
                {
                    if (!ridgeClones.ContainsKey(ridge))
                    {
                        Ridge ridgeClone = new Ridge();
                        ridgeClone.Start = minutiaClones[ridge.Start];
                        ridgeClone.End   = minutiaClones[ridge.End];
                        foreach (Point point in ridge.Points)
                        {
                            ridgeClone.Points.Add(point);
                        }
                        ridgeClones[ridge]          = ridgeClone;
                        ridgeClones[ridge.Reversed] = ridgeClone.Reversed;
                    }
                }
            }

            return(clone);
        }
Beispiel #8
0
        Dictionary <Point, SkeletonBuilder.Minutia> ComputeMinutiaCenters(Dictionary <Point, List <Point> > linking, SkeletonBuilder skeleton)
        {
            Dictionary <Point, SkeletonBuilder.Minutia> centers = new Dictionary <Point, SkeletonBuilder.Minutia>();

            foreach (Point currentPos in linking.Keys)
            {
                List <Point> linkedMinutiae = linking[currentPos];
                Point        primaryPos     = linkedMinutiae[0];
                if (!centers.ContainsKey(primaryPos))
                {
                    Point sum = new Point();
                    foreach (Point linkedPos in linkedMinutiae)
                    {
                        sum = Calc.Add(sum, linkedPos);
                    }
                    Point center = new Point(sum.X / linkedMinutiae.Count, sum.Y / linkedMinutiae.Count);
                    SkeletonBuilder.Minutia minutia = new SkeletonBuilder.Minutia(center);
                    skeleton.AddMinutia(minutia);
                    centers[primaryPos] = minutia;
                }
                centers[currentPos] = centers[primaryPos];
            }
            return(centers);
        }