Exemple #1
0
        public static double CompareFingerprints(Bitmap bitmap1, Bitmap bitmap2)
        //public static double CompareFingerprints(byte[] inputFingerprint, byte[] databaseFingerprint)
        {
            //var incomingImage1 = Image.FromStream(new MemoryStream(inputFingerprint));
            //var bitmap1 = new Bitmap(incomingImage1);

            //var incomingImage2 = Image.FromStream(new MemoryStream(databaseFingerprint));
            //var bitmap2 = new Bitmap(incomingImage2);

            var fingerprintImg1 = bitmap1;
            var fingerprintImg2 = bitmap2;

            // Building feature extractor and extracting features
            var featExtractor = new MTripletsExtractor()
            {
                MtiaExtractor = new Ratha1995MinutiaeExtractor()
            };
            var features1 = featExtractor.ExtractFeatures(fingerprintImg1);
            var features2 = featExtractor.ExtractFeatures(fingerprintImg2);

            // Building matcher and matching
            var matcher    = new M3gl();
            var similarity = matcher.Match(features1, features2);

            return(similarity);
        }
        public override void Show(List <Minutia> features, Graphics g)
        {
            var mtpFeatureExtractor = new MTripletsExtractor()
            {
                NeighborsCount = 2
            };
            MtripletsFeature mtriplets = mtpFeatureExtractor.ExtractFeatures(features);

            foreach (MTriplet mt in mtriplets.MTriplets)
            {
                Pen pen = new Pen(Color.Blue)
                {
                    Width = 2
                };
                Point[] points = new Point[3];
                for (int i = 0; i < 3; i++)
                {
                    points[i] = new Point()
                    {
                        X = Convert.ToInt32(mt[i].X),
                        Y = Convert.ToInt32(mt[i].Y)
                    }
                }
                ;
                g.DrawPolygon(new Pen(Color.White, 4), points);
                g.DrawPolygon(pen, points);
            }

            var mtiaDisplay = new MinutiaeDisplay();

            mtiaDisplay.Show(mtriplets.Minutiae, g);
        }
    }
        public static bool compareFP(Image inFp, List <Image> dbFp)
        {
            // Description: compares the scanned fingerprint to all of the ones in the database
            bool   isMatch  = false;
            double matchTol = 0.4;

            // Build feature extractor, and extract features of each fingerprint image
            MTripletsExtractor featExtract = new MTripletsExtractor()
            {
                MtiaExtractor = new Ratha1995MinutiaeExtractor()
            };
            var inFeat = featExtract.ExtractFeatures(new Bitmap(inFp));

            // Build matcher
            M3gl matcher = new M3gl();

            // Compare scanned image to all the ones in the database
            int numFp = dbFp.Count;

            //inFp.Save("in.bmp"); testing
            for (int i = 0; i < numFp; i++)
            {
                // Convert dbFp to Bitmap image object
                // DEBUG: save to file

                // Extract features of dbBmp
                var dbFeat = featExtract.ExtractFeatures(new Bitmap(dbFp[i]));

                // Run similarity check
                var match = matcher.Match(inFeat, dbFeat);
                //dbFp[i].Save("dbFP-"+i.ToString()+".bmp"); testing
                if (match >= matchTol)
                {
                    // Fingerprints have above 0.5 similarity
                    isMatch = true;
                    Console.WriteLine("Similarity: ", match); // Debug
                    break;                                    // Comment for debug
                }
            }

            return(isMatch);
        }
        private double MatchfingerPrints(Bitmap im1, Bitmap im2)
        {
            // Loading fingerprints
            var fingerprintImg1 = im1;
            var fingerprintImg2 = im2;

            // Building feature extractor and extracting features
            var featExtractor = new MTripletsExtractor()
            {
                MtiaExtractor = new Ratha1995MinutiaeExtractor()
            };
            var features1 = featExtractor.ExtractFeatures(fingerprintImg1);
            var features2 = featExtractor.ExtractFeatures(fingerprintImg2);

            // Building matcher and matching
            var    matcher    = new M3gl();
            double similarity = matcher.Match(features1, features2);


            return(similarity * 100);
        }
Exemple #5
0
        public void Test1()
        {
            string s;

            try
            {
                //https://www.codeproject.com/Articles/97590/A-Framework-in-C-for-Fingerprint-Verification
                double similarity = 0;
                s = "Hello";

                // Loading fingerprints
                var fingerprintImg1 = ImageLoader.LoadImage2("fp1.jpg");
                var fingerprintImg2 = ImageLoader.LoadImage2("fp1.jpg");
                //var fingerprintImg1 = new Bitmap(stream1);
                //var fingerprintImg2 = new Bitmap(stream2);

                // Building feature extractor and extracting features
                var featExtractor = new MTripletsExtractor()
                {
                    MtiaExtractor = new Ratha1995MinutiaeExtractor()
                };
                var features1 = featExtractor.ExtractFeatures(fingerprintImg1);
                var features2 = featExtractor.ExtractFeatures(fingerprintImg2);

                // Building matcher and matching
                var matcher = new M3gl();
                similarity = matcher.Match(features1, features2);

                s = "Bye with similarity: " + similarity.ToString();
            }
            catch (Exception e)
            {
                var errorMsg = ("Error: " + e.ToString());
                s = errorMsg;
            }
        }