Ejemplo n.º 1
0
        private List <MinutiaPair> GetGlobalMatchingMtiae(IList <MinutiaPair> localMatchingPairs, MinutiaPair refMtiaPair)
        {
            var globalMatchingMtiae = new List <MinutiaPair>(localMatchingPairs.Count);
            var qMatches            = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);
            var tMatches            = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);

            qMatches.Add(refMtiaPair.QueryMtia, refMtiaPair.TemplateMtia);
            tMatches.Add(refMtiaPair.TemplateMtia, refMtiaPair.QueryMtia);

            MtiaMapper mm          = new MtiaMapper(refMtiaPair.QueryMtia, refMtiaPair.TemplateMtia);
            Minutia    refQuery    = mm.Map(refMtiaPair.QueryMtia);
            Minutia    refTemplate = refMtiaPair.TemplateMtia;

            for (int i = 1; i < localMatchingPairs.Count; i++)
            {
                MinutiaPair mtiaPair = localMatchingPairs[i];
                if (!qMatches.ContainsKey(mtiaPair.QueryMtia) && !tMatches.ContainsKey(mtiaPair.TemplateMtia))
                {
                    Minutia query    = mm.Map(mtiaPair.QueryMtia);
                    Minutia template = mtiaPair.TemplateMtia;
                    if (MatchDistance(refQuery, refTemplate, query, template) && MatchDirections(query, template) && MatchPosition(refQuery, refTemplate, query, template))
                    {
                        globalMatchingMtiae.Add(mtiaPair);
                        qMatches.Add(mtiaPair.QueryMtia, mtiaPair.TemplateMtia);
                        tMatches.Add(mtiaPair.TemplateMtia, mtiaPair.QueryMtia);
                    }
                }
            }
            globalMatchingMtiae.Add(refMtiaPair);
            return(globalMatchingMtiae);
        }
Ejemplo n.º 2
0
        private double Eval(Tico2003Features query, Tico2003Features template, List <MinutiaPair> matchingPair)
        {
            if (matchingPair == null)
            {
                return(0);
            }

            var qCenterMtia = matchingPair[matchingPair.Count - 1].QueryMtia;
            var tCenterMtia = matchingPair[matchingPair.Count - 1].TemplateMtia;

            // Computing query bounding region
            var qPolygon = GetBounds(query);

            qPolygon =
                (new PolygonMapper(qCenterMtia, tCenterMtia)).Map(qPolygon);
            var qBoundingRegion = new FingerprintRegion(qPolygon);
            // Computing template bounding region
            var tPolygon        = GetBounds(template);
            var tBoundingRegion = new FingerprintRegion(tPolygon);

            // Mapping query minutiae
            var mtiaMapper = new MtiaMapper(qCenterMtia, tCenterMtia);
            var qMtiae     = new List <Minutia>(query.Minutiae.Count);

            for (int i = 0; i < query.Minutiae.Count; i++)
            {
                var mtia = query.Minutiae[i];
                qMtiae.Add(mtiaMapper.Map(mtia));
            }

            int qCount = 0;

            for (int i = 0; i < qMtiae.Count; i++)
            {
                var mtia = qMtiae[i];
                if (tBoundingRegion.Contains(mtia))
                {
                    qCount++;
                }
            }
            int tCount = 0;

            foreach (var mtia in template.Minutiae)
            {
                if (qBoundingRegion.Contains(mtia))
                {
                    tCount++;
                }
            }

            double sum = 0;

            foreach (var mtiaPair in matchingPair)
            {
                sum += mtiaPair.MatchingValue;
            }

            return(qCount >= MtiaCountThr && tCount >= MtiaCountThr ? 1.0 * sum * sum / (qCount * tCount) : 0);
        }
Ejemplo n.º 3
0
        private static List <MinutiaPair> GetGlobalMatchingMtiae(IList <MinutiaPair> localMatchingPairs, MinutiaPair refMtiaPair,
                                                                 ref int notMatchingCount)
        {
            var globalMatchingMtiae = new List <MinutiaPair>(localMatchingPairs.Count);
            var qMatches            = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);
            var tMatches            = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);

            qMatches.Add(refMtiaPair.QueryMtia, refMtiaPair.TemplateMtia);
            tMatches.Add(refMtiaPair.TemplateMtia, refMtiaPair.QueryMtia);

            var mm          = new MtiaMapper(refMtiaPair.QueryMtia, refMtiaPair.TemplateMtia);
            var refQuery    = mm.Map(refMtiaPair.QueryMtia);
            var refTemplate = refMtiaPair.TemplateMtia;
            var currNotMatchingMtiaCount = 0;
            int i;

            for (i = 0; i < localMatchingPairs.Count; i++)
            {
                var mtiaPair = localMatchingPairs[i];
                if (!qMatches.ContainsKey(mtiaPair.QueryMtia) && !tMatches.ContainsKey(mtiaPair.TemplateMtia))
                {
                    var query    = mm.Map(mtiaPair.QueryMtia);
                    var template = mtiaPair.TemplateMtia;
                    if (MatchDistance(refQuery, refTemplate, query, template) && MatchDirections(query, template) &&
                        MatchPosition(refQuery, refTemplate, query, template))
                    {
                        globalMatchingMtiae.Add(mtiaPair);
                        qMatches.Add(mtiaPair.QueryMtia, mtiaPair.TemplateMtia);
                        tMatches.Add(mtiaPair.TemplateMtia, mtiaPair.QueryMtia);
                    }
                    else
                    {
                        currNotMatchingMtiaCount++;
                    }
                }
                if (currNotMatchingMtiaCount >= notMatchingCount)
                {
                    break;
                }
                //if (globalMatchingMtiae.Count + (localMatchingPairs.Count - i - 1) < MtiaCountThr)
                //    break;
            }
            if (i == localMatchingPairs.Count)
            {
                notMatchingCount = currNotMatchingMtiaCount;
                globalMatchingMtiae.Add(refMtiaPair);
                return(globalMatchingMtiae);
            }
            return(null);
        }
Ejemplo n.º 4
0
        private List <MinutiaPair> GetGlobalMatchingMtiae(List <MinutiaPair> localMatchingPairs, MinutiaPair refMtiaPair, ref int notMatchingCount)
        {
            List <MinutiaPair> globalMatchingMtiae = new List <MinutiaPair>(localMatchingPairs.Count);
            var qMatches = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);
            var tMatches = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);

            qMatches.Add(refMtiaPair.QueryMtia, refMtiaPair.TemplateMtia);
            tMatches.Add(refMtiaPair.TemplateMtia, refMtiaPair.QueryMtia);

            MtiaMapper mm = new MtiaMapper(refMtiaPair.QueryMtia, refMtiaPair.TemplateMtia);
            int        currNotMatchingMtiaCount = 0;
            int        i;

            for (i = 0; i < localMatchingPairs.Count; i++)
            {
                MinutiaPair mtiaPair = localMatchingPairs[i];
                if (!qMatches.ContainsKey(mtiaPair.QueryMtia) && !tMatches.ContainsKey(mtiaPair.TemplateMtia))
                {
                    Minutia query    = mm.Map(mtiaPair.QueryMtia);
                    Minutia template = mtiaPair.TemplateMtia;
                    if (dist.Compare(query, template) <= gdThr && MatchDirections(query, template) && MatchBetaAngle(refMtiaPair, mtiaPair))
                    {
                        globalMatchingMtiae.Add(mtiaPair);
                        qMatches.Add(mtiaPair.QueryMtia, mtiaPair.TemplateMtia);
                        tMatches.Add(mtiaPair.TemplateMtia, mtiaPair.QueryMtia);
                    }
                    else
                    {
                        currNotMatchingMtiaCount++;
                    }
                }
                if (currNotMatchingMtiaCount >= notMatchingCount)
                {
                    break;
                }
                if (globalMatchingMtiae.Count + (localMatchingPairs.Count - i - 1) < MtiaCountThr)
                {
                    break;
                }
            }
            if (i == localMatchingPairs.Count)
            {
                notMatchingCount = currNotMatchingMtiaCount;
                globalMatchingMtiae.Add(refMtiaPair);
                return(globalMatchingMtiae);
            }
            return(null);
        }
Ejemplo n.º 5
0
        private static List <MinutiaPair> GetGlobalMatchingMtiae(IReadOnlyList <MinutiaPair> localMatchingPairs, MinutiaPair refMtiaPair,
                                                                 ref int notMatchingCount)
        {
            var globalMatchingMtiae = new List <MinutiaPair>(localMatchingPairs.Count);
            var qMatches            = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);
            var tMatches            = new Dictionary <Minutia, Minutia>(localMatchingPairs.Count);

            var mm = new MtiaMapper(refMtiaPair.QueryMtia, refMtiaPair.TemplateMtia);
            var currNotMatchingMtiaCount = 0;
            int i;

            for (i = 0; i < localMatchingPairs.Count; i++)
            {
                var mtiaPair = localMatchingPairs[i];
                if (!qMatches.ContainsKey(mtiaPair.QueryMtia) && !tMatches.ContainsKey(mtiaPair.TemplateMtia))
                {
                    var query    = mm.Map(mtiaPair.QueryMtia);
                    var template = mtiaPair.TemplateMtia;
                    if (MtiaEuclideanDistance.Compare(query, template) <= GlobalDistThr && MatchDirections(query, template))
                    {
                        globalMatchingMtiae.Add(mtiaPair);
                        qMatches.Add(mtiaPair.QueryMtia, mtiaPair.TemplateMtia);
                        tMatches.Add(mtiaPair.TemplateMtia, mtiaPair.QueryMtia);
                    }
                    else
                    {
                        currNotMatchingMtiaCount++;
                    }
                }
                if (currNotMatchingMtiaCount >= notMatchingCount)
                {
                    break;
                }
            }
            if (i == localMatchingPairs.Count)
            {
                notMatchingCount = currNotMatchingMtiaCount;
                return(globalMatchingMtiae);
            }
            return(null);
        }
Ejemplo n.º 6
0
        private double Eval(Qi2005Features query, Qi2005Features template, List <MinutiaPair> matchingPair, double[,] simArr)
        {
            var qIndex = new Dictionary <Minutia, int>(query.Minutiae.Count);

            for (int i = 0; i < query.Minutiae.Count; i++)
            {
                qIndex.Add(query.Minutiae[i], i);
            }
            var tIndex = new Dictionary <Minutia, int>(template.Minutiae.Count);

            for (int i = 0; i < template.Minutiae.Count; i++)
            {
                tIndex.Add(template.Minutiae[i], i);
            }

            var qCenterMtia = matchingPair[matchingPair.Count - 1].QueryMtia;
            var tCenterMtia = matchingPair[matchingPair.Count - 1].TemplateMtia;

            // Computing query bounding region
            var qPolygon = GetBounds(query);

            qPolygon =
                (new PolygonMapper(qCenterMtia, tCenterMtia)).Map(qPolygon);
            var qBoundingRegion = new FingerprintRegion(qPolygon);
            // Computing template bounding region
            var tPolygon        = GetBounds(template);
            var tBoundingRegion = new FingerprintRegion(tPolygon);

            // Mapping query minutiae
            var mtiaMapper = new MtiaMapper(qCenterMtia, tCenterMtia);
            var qMtiae     = new List <Minutia>(query.Minutiae.Count);

            for (int i = 0; i < query.Minutiae.Count; i++)
            {
                var mtia = query.Minutiae[i];
                qMtiae.Add(mtiaMapper.Map(mtia));
            }

            int qCount = 0;

            for (int i = 0; i < qMtiae.Count; i++)
            {
                var mtia = qMtiae[i];
                if (tBoundingRegion.Contains(mtia))
                {
                    qCount++;
                }
            }
            int tCount = 0;

            foreach (var mtia in template.Minutiae)
            {
                if (qBoundingRegion.Contains(mtia))
                {
                    tCount++;
                }
            }

            double sum = 0;

            foreach (var mtiaPair in matchingPair)
            {
                int i = qIndex[mtiaPair.QueryMtia];
                int j = tIndex[mtiaPair.TemplateMtia];
                sum += simArr[i, j];
            }

            return(qCount >= 6 && tCount >= 6 ? 1.0 * sum / Math.Max(qCount, tCount) : 0);
        }