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; } } }
private static void AddGapRidge(bool[,] shadow, Gap gap, Point[] 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) { point.Set(shadow, true); } }
private static void TraceRidges(bool[,] thinned, Dictionary <Point, SkeletonMinutia> minutiaePoints) { var leads = new Dictionary <Point, SkeletonRidge>(); foreach (var minutiaPoint in minutiaePoints.Keys) { foreach (var startRelative in Point.CornerNeighbors) { var start = minutiaPoint + startRelative; if (start.Get(thinned, 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 = new Point(); foreach (var 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)); var end = current; ridge.Start = minutiaePoints[minutiaPoint]; ridge.End = minutiaePoints[end]; leads[ridge.Points[1]] = ridge; leads[ridge.Reversed.Points[1]] = ridge; } } } }
private void RemovePores() { const int maxArmLength = 41; foreach (var minutia in Minutiae) { if (minutia.Ridges.Count == 3) { for (var 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 <= maxArmLength && arm2.Points.Count <= maxArmLength) { arm1.Detach(); arm2.Detach(); var merged = new SkeletonRidge(); merged.Start = minutia; merged.End = end; foreach (var point in MathEx.ConstructLine(minutia.Position, end.Position)) { merged.Points.Add(point); } } break; } } } } RemoveKnots(); }
private SkeletonRidge(SkeletonRidge reversed) { Reversed = reversed; Points = new ReversedList <Point>(reversed.Points); }
public SkeletonRidge() { Points = new CircularArray <Point>(); Reversed = new SkeletonRidge(this); }