public double Match(FingerprintTemplate candidate) { const int maxTriedRoots = 70; const int maxTriedTriangles = 7538; Candidate = candidate; var rootIndex = 0; var triangleIndex = 0; double bestScore = 0; foreach (var root in GetRoots()) { var score = TryRoot(root); if (score > bestScore) { bestScore = score; } ++rootIndex; if (rootIndex >= maxTriedRoots) { break; } if (PairCount >= 3) { ++triangleIndex; if (triangleIndex >= maxTriedTriangles) { break; } } } return(bestScore); }
public EdgeShape(FingerprintTemplate template, int reference, int neighbor) { var vector = template.Minutiae[neighbor].Position - template.Minutiae[reference].Position; var quadrant = 0; var x = vector.X; var y = vector.Y; if (y < 0) { x = -x; y = -y; quadrant = 128; } if (x < 0) { var tmp = -x; x = y; y = tmp; quadrant += 64; } var shift = MathEx.HighestBit((uint)(x | y) >> PolarCacheBits); Length = PolarDistance[y >> shift, x >> shift] << shift; var angle = (byte)(PolarAngle[y >> shift, x >> shift] + quadrant); ReferenceAngle = Angle.Difference(template.Minutiae[reference].Direction, angle); NeighborAngle = Angle.Difference(template.Minutiae[neighbor].Direction, Angle.Opposite(angle)); }
public FingerprintMatcher(FingerprintTemplate template) { Template = template; BuildEdgeHash(); PairsByProbe = new PairInfo[Template.Minutiae.Count]; PairList = new PairInfo[Template.Minutiae.Count]; for (var i = 0; i < PairList.Length; ++i) { PairList[i] = new PairInfo(); } }