private double MatchBetaAngles(JiangMinutiaDescriptor target)
        {
            var diff0 = Angle.DifferencePi(target.Beta0, Beta0);
            var diff1 = Angle.DifferencePi(target.Beta1, Beta1);

            return(54 * (Math.Pow(diff0, 2) + Math.Pow(diff1, 2)) / Math.PI);
        }
        private double MatchRidgeCounts(JiangMinutiaDescriptor target)
        {
            double diff0 = Math.Abs(target.RidgeCount0 - RidgeCount0);
            double diff1 = Math.Abs(target.RidgeCount1 - RidgeCount1);

            return(3 * (Math.Pow(diff0, 2) + Math.Pow(diff1, 2)));
        }
        private double MatchDistances(JiangMinutiaDescriptor target)
        {
            var diff0 = Math.Abs(target.Dist0 - Dist0);
            var diff1 = Math.Abs(target.Dist1 - Dist1);

            return(diff0 + diff1);
        }
Example #4
0
        public override JiangFeatures Extract(Bitmap image)
        {
            var minutiae        = MinutiaeExtractor.ExtractFeatures(image);
            var skeletonImg     = SkeletonImageExtractor.ExtractFeatures(image);
            var descriptorsList = new List <JiangMinutiaDescriptor>();

            if (minutiae.Count <= 3)
            {
                return(new JiangFeatures(descriptorsList));
            }

            var mtiaIdx = new Dictionary <Minutia, int>();

            for (var i = 0; i < minutiae.Count; i++)
            {
                mtiaIdx.Add(minutiae[i], i);
            }
            for (short idx = 0; idx < minutiae.Count; idx++)
            {
                var query   = minutiae[idx];
                var nearest = GetNearest(minutiae, query);
                for (var i = 0; i < nearest.Length - 1; i++)
                {
                    for (var j = i + 1; j < nearest.Length; j++)
                    {
                        var newMTriplet = new JiangMinutiaDescriptor(skeletonImg, minutiae, idx, nearest[i],
                                                                     nearest[j]);
                        descriptorsList.Add(newMTriplet);
                    }
                }
            }
            descriptorsList.TrimExcess();
            return(new JiangFeatures(descriptorsList));
        }
        private double MatchByType(JiangMinutiaDescriptor target)
        {
            var diff0 = target.MainMinutia.MinutiaType == MainMinutia.MinutiaType ? 0 : 1;
            var diff1 = target.NearestMtia.MinutiaType == NearestMtia.MinutiaType ? 0 : 1;
            var diff2 = target.FarthestMtia.MinutiaType == FarthestMtia.MinutiaType ? 0 : 1;

            return(3 * (diff0 + diff1 + diff2));
        }
        internal double RotationInvariantMatch(JiangMinutiaDescriptor target)
        {
            var distDiff       = MatchDistances(target);
            var alphaDiff      = MatchAlphaAngles(target);
            var betaDiff       = MatchBetaAngles(target);
            var ridgeCountDiff = MatchRidgeCounts(target);
            var mtiaTypeDiff   = MatchByType(target);

            var dist = Math.Sqrt(distDiff + alphaDiff + betaDiff + ridgeCountDiff + mtiaTypeDiff);

            return(dist < 66 ? (66 - dist) / 66 : 0);
        }
        private bool MatchMtiaDirections(JiangMinutiaDescriptor target)
        {
            var diff = Angle.DifferencePi(target.MainMinutia.Angle, MainMinutia.Angle);

            if (diff >= Math.PI / 4)
            {
                return(false);
            }
            diff = Angle.DifferencePi(target.NearestMtia.Angle, NearestMtia.Angle);
            if (diff >= Math.PI / 4)
            {
                return(false);
            }
            diff = Angle.DifferencePi(target.FarthestMtia.Angle, FarthestMtia.Angle);
            return(!(diff >= Math.PI / 4));
        }