- java.lang.Object
-
- com.machinezoo.sourceafis.FingerprintTemplate
-
public class FingerprintTemplate extends Object
Biometric description of a fingerprint suitable for efficient matching. Fingerprint template holds high-level fingerprint features, specifically ridge endings and bifurcations (together called minutiae). Original image is not preserved in the fingerprint template and there is no way to reconstruct the original fingerprint from its template.FingerprintImage
can be converted to template by callingFingerprintTemplate(FingerprintImage)
constructor.Since image processing is expensive, applications should cache serialized templates. Serialization into CBOR format is performed by
toByteArray()
method. CBOR template can be deserialized by callingFingerprintTemplate(byte[])
constructor.Matching is performed by constructing
FingerprintMatcher
, passing probe fingerprint to itsFingerprintMatcher(FingerprintTemplate)
constructor, and then passing candidate fingerprints to itsFingerprintMatcher.match(FingerprintTemplate)
method.FingerprintTemplate
contains two kinds of data: fingerprint features and search data structures. Search data structures speed up matching at the cost of some RAM. Only fingerprint features are serialized. Search data structures are recomputed after every deserialization.
-
-
Constructor Summary
Constructors Constructor Description FingerprintTemplate()
Deprecated.Use one of the constructors that take parameters to create fully initialized template instead.FingerprintTemplate(byte[] serialized)
Deserializes fingerprint template from byte array.FingerprintTemplate(FingerprintImage image)
Creates fingerprint template from fingerprint image.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FingerprintTemplate
convert(byte[] template)
Deprecated.UseFingerprintCompatibility
methods to import other template formats.FingerprintTemplate
create(byte[] image)
Deprecated.UseFingerprintTemplate(FingerprintImage)
constructor to create template from image.FingerprintTemplate
deserialize(String json)
Deprecated.UseFingerprintTemplate(byte[])
constructor to deserialize the template.FingerprintTemplate
dpi(double dpi)
Deprecated.Set DPI viaFingerprintImageOptions
dpi(double)
instead.static FingerprintTemplate
empty()
Gets the empty fallback template with no biometric data.int
memory()
Estimates memory footprint of the template.String
serialize()
Deprecated.UsetoByteArray()
to serialize the template.byte[]
toByteArray()
Serializes fingerprint template into byte array.FingerprintTemplate
transparency(FingerprintTransparency transparency)
Deprecated.Use thread-local instance ofFingerprintTransparency
instead.
-
-
-
Constructor Detail
-
FingerprintTemplate
public FingerprintTemplate(FingerprintImage image)
Creates fingerprint template from fingerprint image.This constructor runs an expensive feature extractor algorithm, which analyzes the image and collects identifiable biometric features from it.
- Parameters:
-
image
- fingerprint image to process - Throws:
-
NullPointerException
- ifimage
isnull
-
FingerprintTemplate
public FingerprintTemplate(byte[] serialized)
Deserializes fingerprint template from byte array. This constructor reads CBOR-encoded template produced bytoByteArray()
and reconstructs an exact copy of the original fingerprint template.Templates produced by previous versions of SourceAFIS may fail to deserialize correctly. Applications should re-extract all templates from original images when upgrading SourceAFIS.
- Parameters:
-
serialized
- serialized fingerprint template in CBOR format produced bytoByteArray()
- Throws:
-
NullPointerException
- ifserialized
isnull
-
IllegalArgumentException
- ifserialized
is not in the correct format or it is corrupted - See Also:
-
toByteArray()
, Template format,FingerprintImage(byte[])
,FingerprintCompatibility.importTemplate(byte[])
-
FingerprintTemplate
@Deprecated public FingerprintTemplate()
Deprecated.Use one of the constructors that take parameters to create fully initialized template instead.
-
-
Method Detail
-
empty
public static FingerprintTemplate empty()
Gets the empty fallback template with no biometric data. Empty template is useful as a fallback to simplify code. It contains no biometric data and it does not match any other template including itself. There is only one global instance. This method does not instantiate any new objects.- Returns:
- empty template
-
transparency
@Deprecated public FingerprintTemplate transparency(FingerprintTransparency transparency)
Deprecated.Use thread-local instance ofFingerprintTransparency
instead.- Parameters:
-
transparency
- targetFingerprintTransparency
ornull
to disable algorithm transparency - Returns:
-
this
(fluent method) - See Also:
-
FingerprintTransparency
-
dpi
@Deprecated public FingerprintTemplate dpi(double dpi)
Deprecated.Set DPI viaFingerprintImageOptions
dpi(double)
instead.- Parameters:
-
dpi
- DPI of the fingerprint image, usually around 500 - Returns:
-
this
(fluent method) - See Also:
-
FingerprintImageOptions.dpi(double)
-
create
@Deprecated public FingerprintTemplate create(byte[] image)
Deprecated.UseFingerprintTemplate(FingerprintImage)
constructor to create template from image.- Parameters:
-
image
- fingerprint image inImageIO
-supported format - Returns:
-
this
(fluent method) - See Also:
-
FingerprintTemplate(FingerprintImage)
-
deserialize
@Deprecated public FingerprintTemplate deserialize(String json)
Deprecated.UseFingerprintTemplate(byte[])
constructor to deserialize the template.- Parameters:
-
json
- serialized fingerprint template in JSON format produced byserialize()
- Returns:
-
this
(fluent method) - Throws:
-
NullPointerException
- ifjson
isnull
-
RuntimeException
- ifjson
is is not in the correct format or it is corrupted - See Also:
-
FingerprintTemplate(byte[])
-
toByteArray
public byte[] toByteArray()
Serializes fingerprint template into byte array. Serialized template can be stored in a database or sent over network. It can be then deserialized by callingFingerprintTemplate(byte[])
constructor. Persisting templates alongside fingerprint images allows applications to start faster, because template deserialization is more than 100x faster than re-extraction from fingerprint image.Serialized template excludes search structures that
FingerprintTemplate
keeps to speed up matching. Serialized template is therefore much smaller than in-memoryFingerprintTemplate
.Serialization format can change with every SourceAFIS version. There is no backward compatibility of templates. Applications should preserve raw fingerprint images, so that templates can be re-extracted after SourceAFIS upgrade. Template format for current version of SourceAFIS is documented on SourceAFIS website.
- Returns:
- serialized fingerprint template in CBOR format
- See Also:
-
FingerprintTemplate(byte[])
, Template format,FingerprintCompatibility.exportTemplates(TemplateFormat, FingerprintTemplate...)
-
serialize
@Deprecated public String serialize()
Deprecated.UsetoByteArray()
to serialize the template.- Returns:
- serialized fingerprint template in JSON format
- See Also:
-
toByteArray()
-
convert
@Deprecated public FingerprintTemplate convert(byte[] template)
Deprecated.UseFingerprintCompatibility
methods to import other template formats.- Parameters:
-
template
- foreign template to import - Returns:
-
this
(fluent method) - See Also:
-
FingerprintCompatibility.convert(byte[])
-
memory
public int memory()
Estimates memory footprint of the template. Memory (RAM) footprint of templates is usually much larger than serialized size. The estimate should be fairly accurate on all commonly used JVMs.- Returns:
- estimated memory footprint of the template in bytes
-
-