我正在开发一个使用Digital Persona U.are.U4000b指纹识别器的软件。
它工作正常。但我在指纹验证过程中遇到了性能问题。
我的数据库中注册了大约3.000个指纹,我需要在验证过程中循环所有这些指纹。
但每次成功的指纹读取都需要大约7秒的时间来匹配我的数据库的相应记录(这取决于它的索引)。
这对我来说不是一个可以接受的场景,因为我需要注册(并显示他们的数据,照片...实时)在20分钟的间隔中至少400名学生。真正的问题是巨大的指纹数据库,因为当我用一个较小的数据库测试它时,它工作得很好。
我正在使用带有C#的.NET和一个用于指纹的免费软件开发工具包。引起此问题的代码行是在FOREACH中执行的那行代码(对于数据库的每个注册指纹):
verificator.Verify(features, template, ref result);
verificator
是一个处理验证的DPFP.Verification.Verification
对象,fingerprint;template
是一个包含实际数据的DPFP.Template
对象,是一个代表每个注册的fingerprints;result
的DPFP.Verification.Verification
对象,是一个包含每个指纹验证结果的DPFP.FeatureSet
对象。下面是整个process
方法:
protected void process(DPFP.Sample sample)
{
DPFP.FeatureSet features = ExtractFeatures(sample, DPFP.Processing.DataPurpose.Verification);
bool verified = false;
if (features != null)
{
DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
//"allTemplates" is an List<> of objects that contains all the templates previously loaded from DB
//There is no DB access in these lines of code
foreach (var at in allTemplates)
{
verificator.Verify(features, at.template, ref result);
if (result.Verified)
{
register(at.idStudent);
verified = true;
break;
}
}
}
if (!verified)
error("Invalid student.");
}
我做得对吗?
还有另一种方法来做这项工作吗?
https://stackoverflow.com/questions/15125262
复制相似问题