public class FingerprintImage extends Object
FingerprintTemplate
. Since SourceAFIS algorithm is not scale-invariant, all images should have DPI configured explicitly by calling dpi(double)
.
Application should start fingerprint processing by constructing an instance of FingerprintImage
and then passing it to FingerprintTemplate.FingerprintTemplate(FingerprintImage)
.
Fingerprint image can be either in one of the supported image formats (PNG, JPEG, ...), in which case method decode(byte[])
is used, or it can be a raw grayscale image, for which method grayscale(int, int, byte[])
is used.
FingerprintTemplate
Constructor and Description |
---|
FingerprintImage()
Creates new container for fingerprint image data.
|
Modifier and Type | Method and Description |
---|---|
FingerprintImage |
decode(byte[] image)
Decodes fingerprint image in standard format.
|
FingerprintImage |
dpi(double dpi)
Sets DPI (dots per inch) of the fingerprint image.
|
FingerprintImage |
grayscale(int width, int height, byte[] pixels)
Reads raw grayscale fingerprint image from byte array.
|
public FingerprintImage()
FingerprintTemplate
until at least pixel data is provided by calling decode(byte[])
or grayscale(int, int, byte[])
.
decode(byte[])
, grayscale(int, int, byte[])
public FingerprintImage dpi(double dpi)
decode(byte[])
or grayscale(int, int, byte[])
. Check your fingerprint reader specification for correct DPI value. Default DPI is 500.
dpi
- DPI of the fingerprint image, usually around 500
this
(fluent method)
IllegalArgumentException
- if dpi
is non-positive, impossibly low, or impossibly high
decode(byte[])
public FingerprintImage decode(byte[] image)
dpi(double)
.
The image may be in any format commonly used to store fingerprint images, including PNG, JPEG, BMP, TIFF, or WSQ. SourceAFIS will try to decode the image using Java's ImageIO
(PNG, JPEG, BMP, and on Java 9+ TIFF), JNBIS library (WSQ), and Android's Bitmap class (PNG, JPEG, BMP) in this order. Note that these libraries might not support all versions and variations of the mentioned formats.
image
- fingerprint image in one of the supported formats
this
(fluent method)
NullPointerException
- if image
is null
IllegalArgumentException
- if the image format is unsupported or the image is corrupted
dpi(double)
, grayscale(int, int, byte[])
, FingerprintCompatibility.convert(byte[])
, FingerprintTemplate.FingerprintTemplate(byte[])
public FingerprintImage grayscale(int width, int height, byte[] pixels)
dpi(double)
.
Pixels are represented as 8-bit unsigned bytes with 0 meaning black and 255 meaning white. Java's byte is a signed 8-bit number, but this method interprets all 8 bits as an unsigned number as if by calling Byte.toUnsignedInt(byte)
. Pixels in pixels
array are ordered from top-left to bottom-right in horizontal rows. Size of pixels
must be equal to width * height
.
width
- width of the image
height
- height of the image
pixels
- image pixels ordered from top-left to bottom-right in horizontal rows
this
(fluent method)
NullPointerException
- if image
is null
IndexOutOfBoundsException
- if width
or height
is not positive or if pixels
length is not width * height
dpi(double)
, decode(byte[])
Copyright © 2009–2020 Robert Važan. All rights reserved.