コード例 #1
0
ファイル: Skeleton.cs プロジェクト: JKhaledJ/sourceafis-net
 void RemovePores()
 {
     foreach (var minutia in Minutiae)
     {
         if (minutia.Ridges.Count == 3)
         {
             for (int exit = 0; exit < 3; ++exit)
             {
                 var exitRidge = minutia.Ridges[exit];
                 var arm1      = minutia.Ridges[(exit + 1) % 3];
                 var arm2      = minutia.Ridges[(exit + 2) % 3];
                 if (arm1.End == arm2.End && exitRidge.End != arm1.End && arm1.End != minutia && exitRidge.End != minutia)
                 {
                     var end = arm1.End;
                     if (end.Ridges.Count == 3 && arm1.Points.Count <= Parameters.MaxPoreArm && arm2.Points.Count <= Parameters.MaxPoreArm)
                     {
                         arm1.Detach();
                         arm2.Detach();
                         var merged = new SkeletonRidge();
                         merged.Start = minutia;
                         merged.End   = end;
                         foreach (var point in minutia.Position.LineTo(end.Position))
                         {
                             merged.Points.Add(point);
                         }
                     }
                     break;
                 }
             }
         }
     }
     RemoveKnots();
     // https://sourceafis.machinezoo.com/transparency/removed-pores
     FingerprintTransparency.Current.LogSkeleton("removed-pores", this);
 }
コード例 #2
0
        void RemovePores()
        {
            const int maxArmLength = 41;

            foreach (SkeletonMinutia minutia in Minutiae)
            {
                if (minutia.Ridges.Count == 3)
                {
                    for (int exit = 0; exit < 3; ++exit)
                    {
                        SkeletonRidge exitRidge = minutia.Ridges[exit];
                        SkeletonRidge arm1      = minutia.Ridges[(exit + 1) % 3];
                        SkeletonRidge arm2      = minutia.Ridges[(exit + 2) % 3];
                        if (arm1.End == arm2.End && exitRidge.End != arm1.End && arm1.End != minutia && exitRidge.End != minutia)
                        {
                            SkeletonMinutia end = arm1.End;
                            if (end.Ridges.Count == 3 && arm1.Points.Count <= maxArmLength && arm2.Points.Count <= maxArmLength)
                            {
                                arm1.Detach();
                                arm2.Detach();
                                SkeletonRidge merged = new SkeletonRidge();
                                merged.Start = minutia;
                                merged.End   = end;
                                foreach (Point point in MathEx.ConstructLine(minutia.Position, end.Position))
                                {
                                    merged.Points.Add(point);
                                }
                            }
                            break;
                        }
                    }
                }
            }
            RemoveKnots();
        }
コード例 #3
0
        void RemoveKnots()
        {
            foreach (var minutia in Minutiae)
            {
                if (minutia.Ridges.Count == 2 && minutia.Ridges[0].Reversed != minutia.Ridges[1])
                {
                    SkeletonRidge extended = minutia.Ridges[0].Reversed;
                    SkeletonRidge removed  = minutia.Ridges[1];
                    if (extended.Points.Count < removed.Points.Count)
                    {
                        MathEx.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();
                }
            }
            RemoveDots();
        }
コード例 #4
0
 public void AttachStart(SkeletonRidge ridge)
 {
     if (!Ridges.Contains(ridge))
     {
         Ridges.Add(ridge);
         ridge.Start = this;
     }
 }
コード例 #5
0
ファイル: SkeletonMinutia.cs プロジェクト: ProjectoFinal/PS
 public void AttachStart(SkeletonRidge ridge)
 {
     if (!Ridges.Contains(ridge))
     {
         Ridges.Add(ridge);
         ridge.Start = this;
     }
 }
コード例 #6
0
ファイル: SkeletonMinutia.cs プロジェクト: ProjectoFinal/PS
 public void DetachStart(SkeletonRidge ridge)
 {
     if (Ridges.Contains(ridge))
     {
         Ridges.Remove(ridge);
         if (ridge.Start == this)
             ridge.Start = null;
     }
 }
コード例 #7
0
 static void AddGapRidge(bool[,] shadow, Gap gap, Point[] line)
 {
     SkeletonRidge ridge = new SkeletonRidge();
     foreach (Point point in line)
         ridge.Points.Add(point);
     ridge.Start = gap.End1;
     ridge.End = gap.End2;
     foreach (Point point in line)
         point.Set(shadow, true);
 }
コード例 #8
0
 public void DetachStart(SkeletonRidge ridge)
 {
     if (Ridges.Contains(ridge))
     {
         Ridges.Remove(ridge);
         if (ridge.Start == this)
         {
             ridge.Start = null;
         }
     }
 }
コード例 #9
0
        static Point GetAngleSampleForGapRemoval(SkeletonMinutia minutia)
        {
            const int     angleSampleOffset = 22;
            SkeletonRidge ridge             = minutia.Ridges[0];

            if (angleSampleOffset < ridge.Points.Count)
            {
                return(ridge.Points[angleSampleOffset]);
            }
            else
            {
                return(ridge.End.Position);
            }
        }
コード例 #10
0
ファイル: Skeleton.cs プロジェクト: JKhaledJ/sourceafis-net
        static void AddGapRidge(BooleanMatrix shadow, Gap gap, IntPoint[] line)
        {
            var ridge = new SkeletonRidge();

            foreach (var point in line)
            {
                ridge.Points.Add(point);
            }
            ridge.Start = gap.End1;
            ridge.End   = gap.End2;
            foreach (var point in line)
            {
                shadow[point] = true;
            }
        }
コード例 #11
0
        static void AddGapRidge(bool[,] shadow, Gap gap, Point[] line)
        {
            SkeletonRidge ridge = new SkeletonRidge();

            foreach (Point point in line)
            {
                ridge.Points.Add(point);
            }
            ridge.Start = gap.End1;
            ridge.End   = gap.End2;
            foreach (Point point in line)
            {
                point.Set(shadow, true);
            }
        }
コード例 #12
0
        static void TraceRidges(bool[,] thinned, Dictionary <Point, SkeletonMinutia> minutiaePoints)
        {
            Dictionary <Point, SkeletonRidge> leads = new Dictionary <Point, SkeletonRidge>();

            foreach (Point minutiaPoint in minutiaePoints.Keys)
            {
                foreach (Point startRelative in Point.CornerNeighbors)
                {
                    Point start = minutiaPoint + startRelative;
                    if (start.Get(thinned, false) && !minutiaePoints.ContainsKey(start) && !leads.ContainsKey(start))
                    {
                        SkeletonRidge ridge = new SkeletonRidge();
                        ridge.Points.Add(minutiaPoint);
                        ridge.Points.Add(start);
                        Point previous = minutiaPoint;
                        Point current  = start;
                        do
                        {
                            Point next = new Point();
                            foreach (Point nextRelative in Point.CornerNeighbors)
                            {
                                next = current + nextRelative;
                                if (next.Get(thinned, false) && next != previous)
                                {
                                    break;
                                }
                            }
                            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;
                    }
                }
            }
        }
コード例 #13
0
ファイル: Skeleton.cs プロジェクト: JKhaledJ/sourceafis-net
        static void TraceRidges(BooleanMatrix thinned, Dictionary <IntPoint, SkeletonMinutia> minutiaePoints)
        {
            var leads = new Dictionary <IntPoint, SkeletonRidge>();

            foreach (var minutiaPoint in minutiaePoints.Keys)
            {
                foreach (var startRelative in IntPoint.CornerNeighbors)
                {
                    var start = minutiaPoint + startRelative;
                    if (thinned.Get(start, false) && !minutiaePoints.ContainsKey(start) && !leads.ContainsKey(start))
                    {
                        var ridge = new SkeletonRidge();
                        ridge.Points.Add(minutiaPoint);
                        ridge.Points.Add(start);
                        var previous = minutiaPoint;
                        var current  = start;
                        do
                        {
                            var next = IntPoint.Zero;
                            foreach (var nextRelative in IntPoint.CornerNeighbors)
                            {
                                next = current + nextRelative;
                                if (thinned.Get(next, false) && next != previous)
                                {
                                    break;
                                }
                            }
                            previous = current;
                            current  = next;
                            ridge.Points.Add(current);
                        } while (!minutiaePoints.ContainsKey(current));
                        var end = current;
                        ridge.Start                     = minutiaePoints[minutiaPoint];
                        ridge.End                       = minutiaePoints[end];
                        leads[ridge.Points[1]]          = ridge;
                        leads[ridge.Reversed.Points[1]] = ridge;
                    }
                }
            }
        }
コード例 #14
0
        static void TraceRidges(bool[,] thinned, Dictionary<Point, SkeletonMinutia> minutiaePoints)
        {
            Dictionary<Point, SkeletonRidge> leads = new Dictionary<Point, SkeletonRidge>();
            foreach (Point minutiaPoint in minutiaePoints.Keys)
            {
                foreach (Point startRelative in Point.CornerNeighbors)
                {
                    Point start = minutiaPoint + startRelative;
                    if (start.Get(thinned, false) && !minutiaePoints.ContainsKey(start) && !leads.ContainsKey(start))
                    {
                        SkeletonRidge ridge = new SkeletonRidge();
                        ridge.Points.Add(minutiaPoint);
                        ridge.Points.Add(start);
                        Point previous = minutiaPoint;
                        Point current = start;
                        do
                        {
                            Point next = new Point();
                            foreach (Point nextRelative in Point.CornerNeighbors)
                            {
                                next = current + nextRelative;
                                if (next.Get(thinned, false) && next != previous)
                                    break;
                            }
                            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;
                    }
                }
            }
        }
コード例 #15
0
 SkeletonRidge(SkeletonRidge reversed)
 {
     Reversed = reversed;
     Points   = new ReversedList <IntPoint>(reversed.Points);
 }
コード例 #16
0
 public SkeletonRidge()
 {
     Points   = new CircularList <IntPoint>();
     Reversed = new SkeletonRidge(this);
 }
コード例 #17
0
 public SkeletonRidge()
 {
     Points   = new CircularArray <Point>();
     Reversed = new SkeletonRidge(this);
 }
コード例 #18
0
 void RemovePores()
 {
     const int maxArmLength = 41;
     foreach (SkeletonMinutia minutia in Minutiae)
     {
         if (minutia.Ridges.Count == 3)
         {
             for (int exit = 0; exit < 3; ++exit)
             {
                 SkeletonRidge exitRidge = minutia.Ridges[exit];
                 SkeletonRidge arm1 = minutia.Ridges[(exit + 1) % 3];
                 SkeletonRidge arm2 = minutia.Ridges[(exit + 2) % 3];
                 if (arm1.End == arm2.End && exitRidge.End != arm1.End && arm1.End != minutia && exitRidge.End != minutia)
                 {
                     SkeletonMinutia end = arm1.End;
                     if (end.Ridges.Count == 3 && arm1.Points.Count <= maxArmLength && arm2.Points.Count <= maxArmLength)
                     {
                         arm1.Detach();
                         arm2.Detach();
                         SkeletonRidge merged = new SkeletonRidge();
                         merged.Start = minutia;
                         merged.End = end;
                         foreach (Point point in MathEx.ConstructLine(minutia.Position, end.Position))
                             merged.Points.Add(point);
                     }
                     break;
                 }
             }
         }
     }
     RemoveKnots();
 }
コード例 #19
0
ファイル: SkeletonRidge.cs プロジェクト: ProjectoFinal/PS
 public SkeletonRidge()
 {
     Points = new CircularArray<Point>();
     Reversed = new SkeletonRidge(this);
 }
コード例 #20
0
ファイル: SkeletonRidge.cs プロジェクト: ProjectoFinal/PS
 SkeletonRidge(SkeletonRidge reversed)
 {
     Reversed = reversed;
     Points = new ReversedList<Point>(reversed.Points);
 }