Java Implementation of NIST Biometric Image Software (NBIS)
🛠️ NOTE: Due to lack of time, this project is in maintenance mode. Only critical bugs will be fixed. Pull requests are always welcome!
JNBIS is a library, written in Java, to extract and decode NIST (National Institute of Standards and Technology) compressed files and WSQ (Wavelet Scalar Quantization) images. The code has been converted from NBIS (NIST Biometric Image Software) version 1.1 which is written in C. You can find more about NIST Biometric Image Software here.
JNBIS is available in the maven central repository, so you just need to download and add it to your project libraries or if you are using maven, add it to project dependencies.
<dependency>
<groupId>com.github.mhshams</groupId>
<artifactId>jnbis</artifactId>
<version>2.x.x</version>
</dependency>
Alternatively, you can clone the source code and build it with maven. You need JDK version 1.8 or higher to build the code.
$ git clone [email protected]:mhshams/jnbis.git
$ cd jnbis
$ mvn package
Convert WSQ image to PNG image and return the result as File
File png = Jnbis.wsq()
.decode("path/to/wsq/file.wsq")
.toPng()
.asFile("/path/to/final/file.png");
Convert WSQ image to GIF image and return the result as File
File gif = Jnbis.wsq()
.decode(new File("path/to/wsq/file.wsq"))
.toGif()
.asFile("/path/to/final/file.gif");
Convert WSQ image (as input stream) to JPEG image and return the result as File
File jpg = Jnbis.wsq()
.decode(wsqInputStream)
.toJpg()
.asFile("/path/to/final/file.jpg");
Convert WSQ image to PNG image and return the result as InputStream
InputStream pngStream = Jnbis.wsq()
.decode("path/to/wsq/file.wsq")
.toPng()
.asInputStream();
Convert WSQ image to GIF image and return the result as Byte Array
byte[] gifBytes = Jnbis.wsq()
.decode(new File("path/to/wsq/file.wsq"))
.toGif()
.asByteArray();
For more examples check the SampleWsqTest.java in the project source.
Decode a NIST file with given file name
Nist nist = Jnbis.nist().decode("/path/to/nist/file"));
Decode a NIST file with given File instance
Nist nist = Jnbis.nist().decode(new File("/path/to/nist/file"));
Decode a NIST file with given InputStream instance
Nist nist = Jnbis.nist().decode(nistInputStream));
Nist instance contains different types of data, depending on file type. Here is a sample code that extract all fingerprints and save them in individual files.
Nist nist = Jnbis.nist().decode(new File("/path/to/nist/file"));
for (HighResolutionGrayscaleFingerprint fp : nist.getHiResGrayscaleFingerprints()) {
Jnbis.wsq()
.decode(fp.getImageData())
.toPng()
.asFile("/path/fp-" + fp.getImageDesignationCharacter() + ".png");
}
For more examples check the SampleNistTest.java and AnsiReferencesTest.java in the project source.