Beispiel #1
0
 public EdgeHash(Template template, EdgeLookup lookup)
 {
     EdgeLookup = lookup;
     var edgeConstructor = new EdgeConstructor();
     for (int referenceMinutia = 0; referenceMinutia < template.Minutiae.Length; ++referenceMinutia)
         for (int neighborMinutia = 0; neighborMinutia < template.Minutiae.Length; ++neighborMinutia)
             if (referenceMinutia != neighborMinutia)
             {
                 var edge = new IndexedEdge()
                 {
                     Shape = edgeConstructor.Construct(template, referenceMinutia, neighborMinutia),
                     Location = new EdgeLocation(referenceMinutia, neighborMinutia)
                 };
                 foreach (var hash in lookup.HashCoverage(edge.Shape))
                 {
                     object value;
                     List<IndexedEdge> list;
                     if (!Hash.TryGetValue(hash, out value))
                         Hash[hash] = edge;
                     else
                     {
                         list = value as List<IndexedEdge>;
                         if (list == null)
                         {
                             Hash[hash] = list = new List<IndexedEdge>(1);
                             list.Add((IndexedEdge)value);
                         }
                         list.Add(edge);
                     }
                 }
             }
 }
Beispiel #2
0
        public EdgeHash(Template template, EdgeLookup lookup)
        {
            EdgeLookup = lookup;
            var edgeConstructor = new EdgeConstructor();

            for (int referenceMinutia = 0; referenceMinutia < template.Minutiae.Length; ++referenceMinutia)
            {
                for (int neighborMinutia = 0; neighborMinutia < template.Minutiae.Length; ++neighborMinutia)
                {
                    if (referenceMinutia != neighborMinutia)
                    {
                        var edge = new IndexedEdge()
                        {
                            Shape    = edgeConstructor.Construct(template, referenceMinutia, neighborMinutia),
                            Location = new EdgeLocation(referenceMinutia, neighborMinutia)
                        };
                        foreach (var hash in lookup.HashCoverage(edge.Shape))
                        {
                            object             value;
                            List <IndexedEdge> list;
                            if (!Hash.TryGetValue(hash, out value))
                            {
                                Hash[hash] = edge;
                            }
                            else
                            {
                                list = value as List <IndexedEdge>;
                                if (list == null)
                                {
                                    Hash[hash] = list = new List <IndexedEdge>(1);
                                    list.Add((IndexedEdge)value);
                                }
                                list.Add(edge);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public void Analyze(MinutiaPairing pairing, EdgeLookup lookup, Template probe, Template candidate)
        {
            MaxDistanceError = lookup.MaxDistanceError;
            MaxAngleError = lookup.MaxAngleError;
            var innerDistanceRadius = Convert.ToInt32(DistanceErrorFlatness * MaxDistanceError);
            var innerAngleRadius = Convert.ToInt32(AngleErrorFlatness * MaxAngleError);

            PairCount = pairing.Count;

            EdgeCount = 0;
            SupportedCount = 0;
            CorrectTypeCount = 0;
            DistanceErrorSum = 0;
            AngleErrorSum = 0;

            for (int i = 0; i < PairCount; ++i)
            {
                PairInfo pair = pairing.GetPair(i);
                if (pair.SupportingEdges >= MinSupportingEdges)
                    ++SupportedCount;
                EdgeCount += pair.SupportingEdges + 1;
                if (probe.Minutiae[pair.Pair.Probe].Type == candidate.Minutiae[pair.Pair.Candidate].Type)
                    ++CorrectTypeCount;
                if (i > 0)
                {
                    var probeEdge = EdgeConstructor.Construct(probe, pair.Reference.Probe, pair.Pair.Probe);
                    var candidateEdge = EdgeConstructor.Construct(candidate, pair.Reference.Candidate, pair.Pair.Candidate);
                    DistanceErrorSum += Math.Abs(probeEdge.Length - candidateEdge.Length);
                    AngleErrorSum += Math.Max(innerDistanceRadius, Angle.Distance(probeEdge.ReferenceAngle, candidateEdge.ReferenceAngle));
                    AngleErrorSum += Math.Max(innerAngleRadius, Angle.Distance(probeEdge.NeighborAngle, candidateEdge.NeighborAngle));
                }
            }

            float probeFraction = PairCount / (float)probe.Minutiae.Length;
            float candidateFraction = PairCount / (float)candidate.Minutiae.Length;
            PairFraction = (probeFraction + candidateFraction) / 2;
        }
Beispiel #4
0
 public void Reset(EdgeHash hash)
 {
     EdgeLookup = hash.EdgeLookup;
     Hash       = hash.Hash;
 }
Beispiel #5
0
 public void Reset(EdgeHash hash)
 {
     EdgeLookup = hash.EdgeLookup;
     Hash = hash.Hash;
 }