将指纹与数据库SourceAFIS匹配

时间:2019-04-24 20:55:27

标签: c# .net fingerprint

我已经用C#创建了一个非常简单的程序,它将指纹与包含多个指纹的数据库相匹配。我正在使用SourceAFIS来做到这一点。 这是该代码的源代码:

using System;
using System.Drawing;
using System.IO;
using SourceAFIS.Simple;

namespace FingerprintRecognizer
{
    class Class1
    {
        static AfisEngine AFIS = new AfisEngine();
        static Person DatabasePersons = new Person();
        static Person CandidatePerson = new Person();
        static Fingerprint DatabaseFingerprints = new Fingerprint();
        static Fingerprint CanditateFingerprint = new Fingerprint();

        static void Main(string[] args)
        {
            // Populating database with previously saved fingerprints of many people.
            foreach (string DatabaseTIFfiles in Directory.EnumerateFiles(Directory.GetCurrentDirectory() + @"\database\", "*.tif"))
            {
                DatabaseFingerprints.AsBitmap = new Bitmap(Image.FromFile(DatabaseTIFfiles));
                DatabasePersons.Fingerprints.Add(DatabaseFingerprints);
            }

            // Inserting candidate fingerprint in another database.
            CanditateFingerprint.AsBitmap = new Bitmap(Image.FromFile(Directory.GetCurrentDirectory() + @"\testfingerprint.tif"));
            CandidatePerson.Fingerprints.Add(CanditateFingerprint);

            // Extracting skeletons of database fingerprints and candidate fingerprint.
            AFIS.Extract(DatabasePersons);
            AFIS.Extract(CandidatePerson);

            // Matching
            float score = AFIS.Verify(DatabasePersons, CandidatePerson);
            bool match = (score > 80);
            int points = Convert.ToInt32(score);

            if (match)
                Console.WriteLine(string.Format("Fingerprint match with {0} points", points.ToString()));
            else
                Console.WriteLine(string.Format("Fingerprint does not match with {0} points", points.ToString()));

            Console.ReadKey();
        }
    }
}

我将获得两个可能的结果: “指纹与{0}点匹配”或“指纹与{0}点不匹配”

如果可以的话,我希望获得这样的结果:“指纹与“姓氏”匹配。”

我尝试遵循此方法,但我不知道该怎么做。 https://en.wikibooks.org/wiki/SourceAFIS/Tutorial

0 个答案:

没有答案