我在.net框架中使用SourceAFIS进行指纹验证。当我从桌面上拍摄图像时,它工作正常。但是当我从我的localhost服务器使用相同的图像时,我无法加载图像,并且内部显示以下错误'注册'功能:
未处理的类型' System.ApplicationException'发生在SourceAFIS.dll中 附加信息:指纹图像太小。
这是我的代码:
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
//Console.WriteLine(" Image size = {0} x {1} (width x height)", fp.Image.GetLength(1), fp.Image.GetLength(0));
Console.WriteLine(" Loading image from {0}...", filename);
BitmapImage image = new BitmapImage(new Uri(filename, UriKind.RelativeOrAbsolute));
//Console.WriteLine(" Image size = {0} x {1} (width x height)", fp.Image.GetLength(1), fp.Image.GetLength(0));
fp.AsBitmapSource = image;
// Above update of fp.AsBitmapSource 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));
// Initialize empty person object and set its properties
MyPerson person = new MyPerson();
person.Name = name;
// Add fingerprint to the person
person.Fingerprints.Add(fp);
// Execute extraction in order to initialize fp.Template
Console.WriteLine(" Extracting template...");
Afis.Extract(person);
// Check template size
Console.WriteLine(" Template size = {0} bytes", fp.Template.Length);
return person;
}
static void Main(string[] args)
{
// Initialize SourceAFIS
Afis = new AfisEngine();
// Enroll some people
List<MyPerson> database = new List<MyPerson>();
database.Add(Enroll("http://localhost:6060/PhpProject2/img/img2.jpg", "Second"));
}
请您告诉我如何解决这个问题?