- java.lang.Object
-
- com.machinezoo.sourceafis.FingerprintCompatibility
-
public class FingerprintCompatibility extends Object
Collection of methods for export and import of foreign fingerprint template formats. Only publicly documented formats implemented in FingerprintIO are supported, specifically ANSI 378 (2004, 2009, and 2009/Am1) and ISO 19794-2 (2005 and 2011 off-card variants).ANSI and ISO template specs prescribe specific ways to calculate minutia position and angle. They even vary these calculations between versions of the same spec. SourceAFIS has its own algorithms to determine minutia positions and angles. Conversion routines currently don't attempt to compensate for this difference. They just copy minutia positions and angles to the target template without any adjustments. This may result in some loss of accuracy when matching against templates from other sources.
Note that the use of these so-called "standard" templates for fingerprint exchange is strongly discouraged in favor of plain fingerprint images.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FingerprintTemplate
convert(byte[] template)
Deprecated.UseimportTemplate(byte[])
instead.static List<FingerprintTemplate>
convertAll(byte[] template)
Deprecated.UseimportTemplates(byte[])
instead.static byte[]
exportTemplates(TemplateFormat format, FingerprintTemplate... templates)
Converts one or more native templates to non-native template format.static FingerprintTemplate
importTemplate(byte[] template)
Converts non-native fingerprint template to native SourceAFIS template.static List<FingerprintTemplate>
importTemplates(byte[] template)
Converts non-native fingerprint template to a list of native SourceAFIS templates.static List<FingerprintTemplate>
importTemplates(byte[] template, ExceptionHandler handler)
Validates and then converts non-native fingerprint template to a list of native SourceAFIS templates.static byte[]
toAnsiIncits378v2004(FingerprintTemplate... templates)
Deprecated.static byte[]
toAnsiIncits378v2009(FingerprintTemplate... templates)
Deprecated.static byte[]
toAnsiIncits378v2009AM1(FingerprintTemplate... templates)
Deprecated.static String
version()
Gets version of the currently running SourceAFIS.
-
-
-
Method Detail
-
version
public static String version()
Gets version of the currently running SourceAFIS. This is useful during upgrades when the application has to deal with possible template incompatibility between versions.- Returns:
- SourceAFIS version in a three-part 1.2.3 format
-
importTemplates
public static List<FingerprintTemplate> importTemplates(byte[] template, ExceptionHandler handler)
Validates and then converts non-native fingerprint template to a list of native SourceAFIS templates. Several native templates can be returned for one non-native template, because many non-native template formats can contain multiple fingerprints while native SourceAFIS templates always contain one fingerprint.This method accepts publicly documented template formats implemented in FingerprintIO library, specifically ANSI 378 (2004, 2009, and 2009/Am1) and ISO 19794-2 (2005 and 2011 off-card variants).
Recoverable parsing exceptions are passed to the provided exception handler. Use
Exceptions.silence()
for permissive parsing andExceptions.propagate()
for strict parsing. The former is equivalent to callingimportTemplates(byte[])
.If you just need to deserialize native SourceAFIS template, call
FingerprintTemplate(byte[])
instead. To create template from fingerprint image, callFingerprintTemplate(FingerprintImage)
.- Parameters:
-
template
- non-native template in one of the supported formats -
handler
- exception handler for recoverable parsing exceptions - Returns:
- native templates containing fingerprints from the non-native template
- Throws:
-
NullPointerException
- iftemplate
isnull
-
TemplateFormatException
- iftemplate
is in an unsupported format or it is corrupted - See Also:
-
importTemplates(byte[])
,importTemplate(byte[])
,exportTemplates(TemplateFormat, FingerprintTemplate...)
, FingerprintIO
-
importTemplates
public static List<FingerprintTemplate> importTemplates(byte[] template)
Converts non-native fingerprint template to a list of native SourceAFIS templates. Several native templates can be returned for one non-native template, because many non-native template formats can contain multiple fingerprints while native SourceAFIS templates always contain one fingerprint.This method accepts publicly documented template formats implemented in FingerprintIO library, specifically ANSI 378 (2004, 2009, and 2009/Am1) and ISO 19794-2 (2005 and 2011 off-card variants).
Template is parsed permissively. Recoverable errors are ignored. To customize error handling, call
importTemplates(byte[], ExceptionHandler)
.If you just need to deserialize native SourceAFIS template, call
FingerprintTemplate(byte[])
instead. To create template from fingerprint image, callFingerprintTemplate(FingerprintImage)
.- Parameters:
-
template
- non-native template in one of the supported formats - Returns:
- native templates containing fingerprints from the non-native template
- Throws:
-
NullPointerException
- iftemplate
isnull
-
TemplateFormatException
- iftemplate
is in an unsupported format or it is corrupted - See Also:
-
importTemplates(byte[], ExceptionHandler)
,importTemplate(byte[])
,exportTemplates(TemplateFormat, FingerprintTemplate...)
, FingerprintIO
-
importTemplate
public static FingerprintTemplate importTemplate(byte[] template)
Converts non-native fingerprint template to native SourceAFIS template. Single non-native template may contain multiple fingerprints. This method returns the first one. CallimportTemplates(byte[])
to convert all fingerprints in the template.This method accepts publicly documented template formats implemented in FingerprintIO library, specifically ANSI 378 (2004, 2009, and 2009/Am1) and ISO 19794-2 (2005 and 2011 off-card variants).
Template is parsed permissively. Recoverable errors are ignored. To customize error handling, call
importTemplates(byte[], ExceptionHandler)
.If you just need to deserialize native SourceAFIS template, call
FingerprintTemplate(byte[])
instead. To create template from fingerprint image, callFingerprintTemplate(FingerprintImage)
.- Parameters:
-
template
- non-native template in one of the supported formats - Returns:
- converted native template
- Throws:
-
NullPointerException
- iftemplate
isnull
-
TemplateFormatException
- iftemplate
is in an unsupported format or it is corrupted -
IllegalArgumentException
- iftemplate
contains no fingerprints - See Also:
-
FingerprintTemplate(byte[])
,importTemplates(byte[])
,exportTemplates(TemplateFormat, FingerprintTemplate...)
, FingerprintIO
-
exportTemplates
public static byte[] exportTemplates(TemplateFormat format, FingerprintTemplate... templates)
Converts one or more native templates to non-native template format. Several native templates can be provided, because many non-native template formats can encode several fingerprints in one template. Creating template with zero fingerprints is allowed by some formats.This method supports publicly documented template formats implemented in FingerprintIO library, specifically ANSI 378 (2004, 2009, and 2009/Am1) and ISO 19794-2 (2005 and 2011 off-card variants). To tweak contents of the exported template, deserialize it with FingerprintIO, perform required changes, and serialize it again with FingerprintIO.
If you just need to serialize native SourceAFIS template, call
FingerprintTemplate.toByteArray()
instead.- Parameters:
-
format
- target non-native template format -
templates
- list of native SourceAFIS templates to export - Returns:
- template in the specified non-native format
- Throws:
-
NullPointerException
- ifformat
,templates
, or any of the templates arenull
-
TemplateFormatException
- ifformat
is unsupported or export fails for some reason - See Also:
-
FingerprintTemplate.toByteArray()
,importTemplates(byte[])
, FingerprintIO
-
convertAll
@Deprecated public static List<FingerprintTemplate> convertAll(byte[] template)
Deprecated.UseimportTemplates(byte[])
instead.- Parameters:
-
template
- foreign template in one of the supported formats - Returns:
- native templates containing fingerprints from the foreign template
- Throws:
-
NullPointerException
- iftemplate
isnull
-
TemplateFormatException
- iftemplate
is in an unsupported format or it is corrupted
-
convert
@Deprecated public static FingerprintTemplate convert(byte[] template)
Deprecated.UseimportTemplate(byte[])
instead.- Parameters:
-
template
- foreign template in one of the supported formats - Returns:
- converted native template
- Throws:
-
NullPointerException
- iftemplate
isnull
-
TemplateFormatException
- iftemplate
is in an unsupported format or it is corrupted -
IllegalArgumentException
- iftemplate
contains no fingerprints
-
toAnsiIncits378v2004
@Deprecated public static byte[] toAnsiIncits378v2004(FingerprintTemplate... templates)
Deprecated.- Parameters:
-
templates
- list of native SourceAFIS templates to export - Returns:
- ANSI 378-2004 template
- Throws:
-
NullPointerException
- iftemplates
or any of its items isnull
-
toAnsiIncits378v2009
@Deprecated public static byte[] toAnsiIncits378v2009(FingerprintTemplate... templates)
Deprecated.- Parameters:
-
templates
- list of native SourceAFIS templates to export - Returns:
- ANSI 378-2009 template
- Throws:
-
NullPointerException
- iftemplates
or any of its items isnull
-
toAnsiIncits378v2009AM1
@Deprecated public static byte[] toAnsiIncits378v2009AM1(FingerprintTemplate... templates)
Deprecated.- Parameters:
-
templates
- list of native SourceAFIS templates to export - Returns:
- ANSI 378-2009/AM1 template
- Throws:
-
NullPointerException
- iftemplates
or any of its items isnull
-
-