Esempio n. 1
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();
        }
Esempio n. 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();
        }