I"m using FingerCell Extractor in order to obtain a fingerprint template from a bitmap. The problem is that sometimes (I think when the core of the fingerprint it"s not on the image), I got System.NullReferenceException. If the fingerprint contains the core, I get the template correctly.
As the templates are being processed with FingerCell after being adquired with the sensor, I need to check whether the core is on the image or not. I expected that if the core is not in the image I will get a Bad Quality Message from the DLL, but instead I"m getting that exception... Any ideas to avoid that? It"s possible to check if the core is on the image before creating the template?
Here is my code:
- Code: Select all
FncResult GetQuality(Bitmap ^ bitmap, String ^ sensor) {
FncResult result = FNC_OK;
NImage ^ image = NImage::FromBitmap(bitmap);
bool available = NLicense::ObtainComponents("/local", 5000, "Biometrics.FingerExtraction");
if (available) {
Neurotec::FingerCell::FingerCell m_extractor;
if (sensor == "EikonTouch" || sensor == "Fingerprints") {
image->HorzResolution = 508;
image->VertResolution = 508;
}
else if (sensor == "SideTouch") {
image->HorzResolution = 373;
image->VertResolution = 373;
}
else if (sensor == "NB-2020-U" || sensor == "NB-2024-U") {
image->HorzResolution = 385;
image->VertResolution = 385;
}
image->ResolutionIsAspectRatio = false;
NBuffer ^ templateBuffer = m_extractor.Extract(image);
if (templateBuffer->Size == 0) {
result = FNC_E_BAD_QUALITY;
}
else result = FNC_OK;
}
else result = FNC_E_NO_RECORDS;
NLicense::ReleaseComponents("Biometrics.FingerExtraction");
return result;
}