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); }
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(); }
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(); }
public void AttachStart(SkeletonRidge ridge) { if (!Ridges.Contains(ridge)) { Ridges.Add(ridge); ridge.Start = this; } }
public void DetachStart(SkeletonRidge ridge) { if (Ridges.Contains(ridge)) { Ridges.Remove(ridge); if (ridge.Start == this) ridge.Start = null; } }
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); }
public void DetachStart(SkeletonRidge ridge) { if (Ridges.Contains(ridge)) { Ridges.Remove(ridge); if (ridge.Start == this) { ridge.Start = null; } } }
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); } }
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; } }
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); } }
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; } } } }
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; } } } }
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; } } } }
SkeletonRidge(SkeletonRidge reversed) { Reversed = reversed; Points = new ReversedList <IntPoint>(reversed.Points); }
public SkeletonRidge() { Points = new CircularList <IntPoint>(); Reversed = new SkeletonRidge(this); }
public SkeletonRidge() { Points = new CircularArray <Point>(); Reversed = new SkeletonRidge(this); }
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(); }
public SkeletonRidge() { Points = new CircularArray<Point>(); Reversed = new SkeletonRidge(this); }
SkeletonRidge(SkeletonRidge reversed) { Reversed = reversed; Points = new ReversedList<Point>(reversed.Points); }