public void LoadTestFingerPrintImages(string imageDirectory) { DirectoryInfo dirInfo = new DirectoryInfo(imageDirectory); Fingerprint fingerprint = null; if (dirInfo.Exists) { foreach (DirectoryInfo dir in dirInfo.GetDirectories()) { foreach (DirectoryInfo dirSub in dir.GetDirectories()) { foreach (DirectoryInfo dirSub2 in dirSub.GetDirectories()) { foreach (FileInfo file in dirSub2.GetFiles()) { fingerprint = new Fingerprint(); fingerprint.AsBitmapSource = WpfIO.Load(file.FullName); if (fingerprint.Image != null) { Afis.ExtractFingerprint(fingerprint); fingerprintList.Add(fingerprint.GetTemplate()); PatientFingerprintMinutia dbFingerprintMinutia = new PatientFingerprintMinutia(nextID, 1, fingerprint.GetTemplate()); dbFingerprintMinutiaList.Add(dbFingerprintMinutia); nextID = nextID + 1; } } } } } _probe = fingerprint; } SerializeDatabaseProto serialize = new SerializeDatabaseProto(); serialize.WriteToDisk(DATABASE_PATH + @"finger.hive.0001.biodb", dbFingerprintMinutiaList); }
public void LoadTestFingerPrintImages(string imageDirectory, bool breakAtOneHundred = false) { DirectoryInfo dirInfo = new DirectoryInfo(imageDirectory); Fingerprint fingerprint = null; if (dirInfo.Exists) { foreach (DirectoryInfo dir in dirInfo.GetDirectories()) { foreach (DirectoryInfo dirSub in dir.GetDirectories()) { foreach (DirectoryInfo dirSub2 in dirSub.GetDirectories()) { foreach (FileInfo file in dirSub2.GetFiles()) { fingerprint = new Fingerprint(); fingerprint.AsBitmapSource = WpfIO.Load(file.FullName); if (fingerprint.Image != null) { Afis.ExtractFingerprint(fingerprint); Template template = fingerprint.GetTemplate(); template.NoID.LocalNoID = "Test" + nextID.ToString(); dbMinutia.AddTemplate(template); nextID++; if (breakAtOneHundred && nextID > 10) { break; } } } } } } } }
void Collect(FingerprintOptions options) { InputImage = options.Path != "" ? WpfIO.GetPixels(WpfIO.Load(options.Path)) : null; if (InputImage != null) { Extractor.Extract(InputImage, 500); } Logs = Logger.PopLog(); }
void RunMatcherBenchmark() { #if !MONO if (Options.RenderGraph) { AccuracyStatistics.GraphDrawer = (curve, file) => { WpfIO.Save(RocGraph.Render(curve), file); } } ; #endif string dbPath = Path.Combine("Extractor", "Templates.dat"); if (File.Exists(dbPath)) { TestDatabase.Load(dbPath); } else { RunExtractorBenchmark(); } Console.WriteLine("Running matcher benchmark"); MatcherReport report = MatcherBenchmark.Run(); Console.WriteLine("Saving matcher report"); report.Save("Matcher"); } void RunOptimizer() { Optimizer.OnException += delegate(Exception e) { Console.WriteLine("Optimizer iteration failed: {0}", e.ToString()); }; Optimizer.Mutations.OnMutation += delegate(ParameterValue initial, ParameterValue mutated) { Console.WriteLine("Mutated {0}, {1} -> {2}", initial.FieldPath, initial.Value.Double, mutated.Value.Double); }; Optimizer.NicheSlot.OnAccepted += message => { Console.WriteLine("-----> Accepted: " + message); Optimizer.NicheSlot.Save("Optimizer"); }; Optimizer.NicheSlot.OnRejected += message => { Console.WriteLine("Rejected: " + message); }; Console.WriteLine("Running optimizer"); Optimizer.Run(); }
public ExtractorReport Run() { ExtractorReport report = new ExtractorReport(); report.Templates = Database.Clone(); int count = 0; SerializedFormat serializedFormat = new SerializedFormat(); CompactFormat compactFormat = new CompactFormat(); Stopwatch timer = new Stopwatch(); timer.Start(); foreach (TestDatabase database in report.Templates.Databases) { foreach (DatabaseIndex index in database.AllIndexes) { #if !MONO byte[,] grayscale = WpfIO.GetPixels(WpfIO.Load(database[index].FilePath)); #else byte[,] grayscale = GdiIO.Load(database[index].FilePath); #endif TemplateBuilder builder = Extractor.Extract(grayscale, database.Dpi); Template template = serializedFormat.Export(builder); database[index].Template = template; report.MinutiaCount += template.Minutiae.Length; report.TemplateSize += compactFormat.Export(builder).Length; ++count; if (timer.Elapsed.TotalSeconds > Timeout) { throw new TimeoutException("Timeout in extractor"); } } } timer.Stop(); report.Time = (float)(timer.Elapsed.TotalSeconds / count); report.MinutiaCount /= count; report.TemplateSize /= count; return(report); }
public void LoadProbeImages(string imageDirectory) { DirectoryInfo dirInfo = new DirectoryInfo(imageDirectory); Fingerprint fingerprint = null; if (dirInfo.Exists) { foreach (FileInfo file in dirInfo.GetFiles()) { fingerprint = new Fingerprint(); fingerprint.AsBitmapSource = WpfIO.Load(file.FullName); if (fingerprint.Image != null) { _probeList.Add(fingerprint); } } if (_probeList.Count > 0) { _currentProbe = _probeList[0]; _ordinal = 1; } } }