我正在使用vs2008和SourceAFIS 1.1 我无法访问任何方法可能有人帮助我开始 他们(SourceAFIS)给了我们以下样本作为Program.cs 我想开发一个应用程序,首先注册用户,然后识别他们是否注册用户。
namespace Sample
{
public class Program
{
// Inherit from Fingerprint in order to add Filename field
[Serializable]
class MyFingerprint : Fingerprint
{
public string Filename;
}
// Inherit from Person in order to add Name field
[Serializable]
class MyPerson : Person
{
public string Name;
}
// Initialize path to images
static readonly string ImagePath = Path.Combine(Path.Combine("..", ".."), "images");
// Shared AfisEngine instance (cannot be shared between different threads though)
static AfisEngine Afis;
// Take fingerprint image file and create Person object from the image
static MyPerson Enroll(string filename, string name)
{
Console.WriteLine("Enrolling {0}...", name);
// Initialize empty fingerprint object and set properties
MyFingerprint fp = new MyFingerprint();
fp.Filename = filename;
// Load image from the file, fp.BitmapImage makes a copy of the image, so that we can dispose it afterwards
Console.WriteLine(" Loading image from {0}...", filename);
using (Image fromFile = Bitmap.FromFile(filename))
using (Bitmap bitmap = new Bitmap(fromFile))
fp.BitmapImage = bitmap;
// Above update of fp.BitmapImage initialized also raw image in fp.Image
// Check raw image dimensions, Y axis is first, X axis is second
Console.WriteLine(" Image size = {0} x {1} (width x height)", fp.Image.GetLength(1), fp.Image.GetLength(0));
// Execute extraction in order to initialize fp.Template
Console.WriteLine(" Extracting template...");
Afis.Extract(fp);
// Check template size
Console.WriteLine(" Template size = {0} bytes", fp.Template.Length);
// Initialize empty person object and set its properties
MyPerson person = new MyPerson();
person.Name = name;
// Add fingerprint to the person
person.Add(fp);
return person;
}
static void Main(string[] args)
{
// Initialize SourceAFIS
Afis = new AfisEngine();
// Enroll some people
List<MyPerson> database = new List<MyPerson>();
database.Add(Enroll(Path.Combine(ImagePath, "candidate1.tif"), "Fred Flintstone"));
database.Add(Enroll(Path.Combine(ImagePath, "candidate2.tif"), "Wilma Flintstone"));
database.Add(Enroll(Path.Combine(ImagePath, "candidate3.tif"), "Barney Rubble"));
// Save the database to disk and load it back, just to try out the serialization
BinaryFormatter formatter = new BinaryFormatter();
Console.WriteLine("Saving database...");
using (Stream stream = File.Open("database.dat", FileMode.Create))
formatter.Serialize(stream, database);
Console.WriteLine("Reloading database...");
using (FileStream stream = File.OpenRead("database.dat"))
database = (List<MyPerson>)formatter.Deserialize(stream);
// Enroll visitor with unknown identity
MyPerson probe = Enroll(Path.Combine(ImagePath, "probe.tif"), "Visitor #12345");
// Look up the probe using Threshold = 10
Afis.Threshold = 10;
Console.WriteLine("Identifying {0} in database of {1} persons...", probe.Name, database.Count);
MyPerson match = Afis.Identify(probe, database);
// Null result means that there is no candidate with similarity score above threshold
if (match == null)
{
Console.WriteLine("No matching person found.");
return;
}
// Print out any non-null result
Console.WriteLine("Probe {0} matches registered person {1}", probe.Name, match.Name);
// Compute similarity score
float score = Afis.Verify(probe, match);
Console.WriteLine("Similarity score between {0} and {1} = {2:F3}", probe.Name, match.Name, score);
}
}
答案 0 :(得分:1)
$("div").slice(0,2).wrapAll("<div class='MAIN-CLASS'></div>");