private void matchWithDbToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool                   isMatched         = false;
            List <Minutiae>        originalMinutiaes = GetMinutiaesFromBitmap(originalBitmap);
            DbJSONSerializer       db              = new DbJSONSerializer();
            Fingerprints           fingerprints    = db.DeserializeMinutiaes(db.ReadFromJsonFile("db_fingerprints.json"));
            List <UserFingerprint> userFingerPrint = fingerprints.userFingerprints;

            foreach (UserFingerprint uf in userFingerPrint)
            {
                Debug.Print("Porównuje " + uf.name);
                MatchingFingerprints.SetAccumulatorDimension(originalBitmap.Width, originalBitmap.Height);
                TranslationVotes votes = MatchingFingerprints.Matching(originalMinutiaes, uf.minutiaes);
                if (MatchingFingerprints.IsIdentical(originalMinutiaes, uf.minutiaes, votes))
                {
                    isMatched = true;
                    MessageBox.Show(uf.name);
                    break;
                }
            }
            if (!isMatched)
            {
                MessageBox.Show("Brak usera w bazie");
            }
        }
Example #2
0
        public MatcherWithDb(List <Minutiae> originalMinutiaes, string dbFileName)
        {
            DbJSONSerializer serializer = new DbJSONSerializer();

            fingerprints = serializer.DeserializeMinutiaes(serializer.ReadFromJsonFile("db_fingerprints.json"));
            List <UserFingerprint> userFingerprints = fingerprints.userFingerprints;

            foreach (UserFingerprint fp in userFingerprints)
            {
                if (CompareFingerprints(originalMinutiaes, fp.minutiaes))
                {
                    Console.WriteLine("Znaleziono odcisk w bazie");
                    break;
                }
            }
        }
        private void CreateDB()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter      = "JPG|*.jpg|PNG|*.png";
            openFileDialog.Multiselect = true;
            openFileDialog.ShowDialog();
            List <UserFingerprint> userFingerprints = new List <UserFingerprint>();

            foreach (String file in openFileDialog.FileNames)
            {
                Bitmap bitmap = (Bitmap)Bitmap.FromFile(file);
                bitmap = Thinning.Thin(bitmap);
                List <Minutiae> minutiaes = GetMinutiaesFromBitmap(bitmap);
                userFingerprints.Add(new UserFingerprint(file, minutiaes));
            }
            Fingerprints     fingerprints = new Fingerprints(userFingerprints);
            DbJSONSerializer db           = new DbJSONSerializer();

            db.WriteToFile(db.SerializeMinutiaes(fingerprints), "db_fingerprints.json");
        }