Beispiel #1
0
 public void Filter(SkeletonBuilder skeleton)
 {
     foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
     {
         if (minutia.Ridges.Count == 3)
         {
             for (int exit = 0; exit < 3; ++exit)
             {
                 SkeletonBuilder.Ridge exitRidge = minutia.Ridges[exit];
                 SkeletonBuilder.Ridge arm1 = minutia.Ridges[(exit + 1) % 3];
                 SkeletonBuilder.Ridge arm2 = minutia.Ridges[(exit + 2) % 3];
                 if (arm1.End == arm2.End && exitRidge.End != arm1.End && arm1.End != minutia && exitRidge.End != minutia)
                 {
                     SkeletonBuilder.Minutia end = arm1.End;
                     if (end.Ridges.Count == 3 && arm1.Points.Count <= MaxArmLength && arm2.Points.Count <= MaxArmLength)
                     {
                         arm1.Detach();
                         arm2.Detach();
                         SkeletonBuilder.Ridge merged = new SkeletonBuilder.Ridge();
                         merged.Start = minutia;
                         merged.End = end;
                         foreach (Point point in Calc.ConstructLine(minutia.Position, end.Position))
                             merged.Points.Add(point);
                     }
                     break;
                 }
             }
         }
     }
     KnotRemover.Filter(skeleton);
     Logger.Log(skeleton);
 }
Beispiel #2
0
 public void Filter(SkeletonBuilder skeleton)
 {
     foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
     {
         if (minutia.Ridges.Count == 3)
         {
             for (int exit = 0; exit < 3; ++exit)
             {
                 SkeletonBuilder.Ridge exitRidge = minutia.Ridges[exit];
                 SkeletonBuilder.Ridge arm1      = minutia.Ridges[(exit + 1) % 3];
                 SkeletonBuilder.Ridge arm2      = minutia.Ridges[(exit + 2) % 3];
                 if (arm1.End == arm2.End && exitRidge.End != arm1.End && arm1.End != minutia && exitRidge.End != minutia)
                 {
                     SkeletonBuilder.Minutia end = arm1.End;
                     if (end.Ridges.Count == 3 && arm1.Points.Count <= MaxArmLength && arm2.Points.Count <= MaxArmLength)
                     {
                         arm1.Detach();
                         arm2.Detach();
                         SkeletonBuilder.Ridge merged = new SkeletonBuilder.Ridge();
                         merged.Start = minutia;
                         merged.End   = end;
                         foreach (Point point in Calc.ConstructLine(minutia.Position, end.Position))
                         {
                             merged.Points.Add(point);
                         }
                     }
                     break;
                 }
             }
         }
     }
     KnotRemover.Filter(skeleton);
     Logger.Log(skeleton);
 }
Beispiel #3
0
        public void Filter(SkeletonBuilder skeleton)
        {
            foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
            {
                if (minutia.Ridges.Count == 2 && minutia.Ridges[0].Reversed != minutia.Ridges[1])
                {
                    SkeletonBuilder.Ridge extended = minutia.Ridges[0].Reversed;
                    SkeletonBuilder.Ridge removed  = minutia.Ridges[1];
                    if (extended.Points.Count < removed.Points.Count)
                    {
                        Calc.Swap(ref extended, ref removed);
                        extended = extended.Reversed;
                        removed  = removed.Reversed;
                    }

                    extended.Points.RemoveAt(extended.Points.Count - 1);
                    foreach (Point point in removed.Points)
                    {
                        extended.Points.Add(point);
                    }

                    extended.End = removed.End;
                    removed.Detach();
                }
            }
            DotRemover.Filter(skeleton);
            Logger.Log(skeleton);
        }
Beispiel #4
0
 void AddRidge(SkeletonBuilder skeleton, BinaryMap shadow, Gap gap, Point[] line)
 {
     SkeletonBuilder.Ridge ridge = new SkeletonBuilder.Ridge();
     foreach (Point point in line)
         ridge.Points.Add(point);
     ridge.Start = gap.End1;
     ridge.End = gap.End2;
     foreach (Point point in line)
         shadow.SetBitOne(point);
 }
Beispiel #5
0
 Point GetAngleSample(SkeletonBuilder.Minutia minutia)
 {
     SkeletonBuilder.Ridge ridge = minutia.Ridges[0];
     if (AngleSampleOffset < ridge.Points.Count)
     {
         return(ridge.Points[AngleSampleOffset]);
     }
     else
     {
         return(ridge.End.Position);
     }
 }
Beispiel #6
0
 void AddRidge(SkeletonBuilder skeleton, BinaryMap shadow, Gap gap, Point[] line)
 {
     SkeletonBuilder.Ridge ridge = new SkeletonBuilder.Ridge();
     foreach (Point point in line)
     {
         ridge.Points.Add(point);
     }
     ridge.Start = gap.End1;
     ridge.End   = gap.End2;
     foreach (Point point in line)
     {
         shadow.SetBitOne(point);
     }
 }
Beispiel #7
0
 public void Filter(SkeletonBuilder skeleton)
 {
     foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
     {
         if (minutia.Ridges.Count == 1)
         {
             SkeletonBuilder.Ridge ridge = minutia.Ridges[0];
             if (ridge.End.Ridges.Count == 1 && ridge.Points.Count < MinFragmentLength)
             {
                 ridge.Detach();
             }
         }
     }
     DotRemover.Filter(skeleton);
     Logger.Log(skeleton);
 }
Beispiel #8
0
        void TraceRidges(BinaryMap binary, Dictionary <Point, SkeletonBuilder.Minutia> minutiaePoints)
        {
            Dictionary <Point, SkeletonBuilder.Ridge> leads = new Dictionary <Point, SkeletonBuilder.Ridge>();

            foreach (Point minutiaPoint in minutiaePoints.Keys)
            {
                foreach (Point startRelative in Neighborhood.CornerNeighbors)
                {
                    Point start = Calc.Add(minutiaPoint, startRelative);
                    if (binary.GetBitSafe(start, false) && !minutiaePoints.ContainsKey(start) && !leads.ContainsKey(start))
                    {
                        SkeletonBuilder.Ridge ridge = new SkeletonBuilder.Ridge();
                        ridge.Points.Add(minutiaPoint);
                        ridge.Points.Add(start);
                        Point previous = minutiaPoint;
                        Point current  = start;
                        do
                        {
                            Point next = new Point();
                            foreach (Point nextRelative in Neighborhood.CornerNeighbors)
                            {
                                next = Calc.Add(current, nextRelative);
                                if (binary.GetBitSafe(next, false) && next != previous)
                                {
                                    break;
                                }
                            }
                            AssertException.Check(next != new Point());
                            previous = current;
                            current  = next;
                            ridge.Points.Add(current);
                        } while (!minutiaePoints.ContainsKey(current));
                        Point end = current;

                        ridge.Start                     = minutiaePoints[minutiaPoint];
                        ridge.End                       = minutiaePoints[end];
                        leads[ridge.Points[1]]          = ridge;
                        leads[ridge.Reversed.Points[1]] = ridge;
                    }
                }
            }
        }
Beispiel #9
0
        void TraceRidges(BinaryMap binary, Dictionary<Point, SkeletonBuilder.Minutia> minutiaePoints)
        {
            Dictionary<Point, SkeletonBuilder.Ridge> leads = new Dictionary<Point, SkeletonBuilder.Ridge>();
            foreach (Point minutiaPoint in minutiaePoints.Keys)
            {
                foreach (Point startRelative in Neighborhood.CornerNeighbors)
                {
                    Point start = Calc.Add(minutiaPoint, startRelative);
                    if (binary.GetBitSafe(start, false) && !minutiaePoints.ContainsKey(start) && !leads.ContainsKey(start))
                    {
                        SkeletonBuilder.Ridge ridge = new SkeletonBuilder.Ridge();
                        ridge.Points.Add(minutiaPoint);
                        ridge.Points.Add(start);
                        Point previous = minutiaPoint;
                        Point current = start;
                        do
                        {
                            Point next = new Point();
                            foreach (Point nextRelative in Neighborhood.CornerNeighbors)
                            {
                                next = Calc.Add(current, nextRelative);
                                if (binary.GetBitSafe(next, false) && next != previous)
                                    break;
                            }
                            AssertException.Check(next != new Point());
                            previous = current;
                            current = next;
                            ridge.Points.Add(current);
                        } while (!minutiaePoints.ContainsKey(current));
                        Point end = current;

                        ridge.Start = minutiaePoints[minutiaPoint];
                        ridge.End = minutiaePoints[end];
                        leads[ridge.Points[1]] = ridge;
                        leads[ridge.Reversed.Points[1]] = ridge;
                    }
                }
            }
        }