Android Question WSQ (fingerprint) library ?

msains

Member
Licensed User
Hi all,
Does anyone know of a reasonably priced or free Android library that will allow me to convert regular images (eg. jpg, png, bmp) into the WSQ (fingerprinting) format ?
 

emexes

Well-Known Member
Licensed User
I'm thinking that the tsunami of replies indicates: perhaps not.

I did find this Android app, though:

https://play.google.com/store/apps/details?id=com.cognaxon.WSQ_viewer

via that the same company produces a Windows SDK for converting to/from the format, so perhaps they have a Java SDK hidden somewhere too.

My original thinking was that my usual image catalog/view program that I've used for 15 years (ThumbsPlus) does everything I need, but it's so good that I haven't updated for ages, and it looks like the current version doesn't support WSQ anyway, so... nice try, no cigar.

Then I looked at www.irfanview.com (is free) and their website there is a WSQ plugin available "WSQ - (version 2008.12.16): allows IrfanView to WSQ (Wavelet Scaler Quantization) files" and so you might be able to track something down via that.

I also found https://www.xnview.com/en/xnconvert/ that advertises SDKs for Windows, Mac and Linux, and so that guy might be up for creating an Android version too.

But... why do you need it? Are you exchanging files with the FBI, or are you just using it because that's the standard that they use. Because WSQ is just an 8-bit grayscale with (minimally) lossy compression, and given today's larger storage options compared to the 1990's, PNG would be be a much more convenient, flexible and widely-supported format (and lossless to boot, albeit larger).
 

msains

Member
Licensed User
Many t
I'm thinking that the tsunami of replies indicates: perhaps not.

I did find this Android app, though:

https://play.google.com/store/apps/details?id=com.cognaxon.WSQ_viewer

via that the same company produces a Windows SDK for converting to/from the format, so perhaps they have a Java SDK hidden somewhere too.

My original thinking was that my usual image catalog/view program that I've used for 15 years (ThumbsPlus) does everything I need, but it's so good that I haven't updated for ages, and it looks like the current version doesn't support WSQ anyway, so... nice try, no cigar.

Then I looked at www.irfanview.com (is free) and their website there is a WSQ plugin available "WSQ - (version 2008.12.16): allows IrfanView to WSQ (Wavelet Scaler Quantization) files" and so you might be able to track something down via that.

I also found https://www.xnview.com/en/xnconvert/ that advertises SDKs for Windows, Mac and Linux, and so that guy might be up for creating an Android version too.

But... why do you need it? Are you exchanging files with the FBI, or are you just using it because that's the standard that they use. Because WSQ is just an 8-bit grayscale with (minimally) lossy compression, and given today's larger storage options compared to the 1990's, PNG would be be a much more convenient, flexible and widely-supported format (and lossless to boot, albeit larger).
Many thanks for your time and comments emexes. In answer to your interest - we're a small South African software company and one of our clients is a specialist Courier delivering Bank cards, Mobile phone SimCards and official Id documents etc. that sometimes (by law) need very tight identity verification. The way it is done and what one is allowed to hold etc., are also very strictly legislated. The WSQ format is one of the requirements for those instances where they are required to verify a consignee by fingerprint.
 

DonManfred

Expert
Licensed User
so perhaps they have a Java SDK hidden somewhere too.
a paid one for $250 or so
http://www.cognaxon.com/index.php?page=wsqlibrary_forwin64
we're a small South African software company and one of our clients
you may want to check https://github.com/kareez/jnbis
It is a free lib. You may need to write a wrapper for it though.
It should be possible to use it with JavaObject.

So you should be able to use it with B4J at least.
You can try if the lib does work on Android...
 

emexes

Well-Known Member
Licensed User
Righto, got distracted, but further to above:

The reasoning behind using WSQ format vs something more standard, is that lossy compression back then was too lossy for the purpose, and lossless compression was too big, per this paper from 20 years ago:

"When a typical fingerprint card is scanned at 500 dpi, with 8 bits/pixel, it results in about 10Mb of data. For 200 million cards, the total size of the digitized collection would be more than 2000 terabytes .Finger print images are routinely sent between law enforcement agencies. Overnight delivery of the actual card is too slow and risky, and sending 10 Mb of data through a 9600 baud modem takes about three hours. Compression is, therefore, a must. At first, it seems that fingerprint compression must be lossless because of the small but important details involved. However, lossless compression methods produce typical compression ratios of 0.5. Most lossy image compression methods involve the loss of small details and are therefore unacceptable. This is where wavelets come into the picture."
Now, ignoring the typo where the guy writes megabits when he means megabytes, let's take the rest as being gospel. Yeah, three hours would be a heck of a long time to wait for a card to come through online. WSQ compression is about 15:1 (= 12 minutes @ 9600 baud) vs lossless compression at 2:1 (= 90 minutes at 2:1) so, back then, WSQ was the obvious winner. But today... that 5 MB lossless (ie, better and even less likely to contain visual artifacts) PNG file takes me 5 seconds or less to receive on my phone, so... unless there is some massively-behind-the-times legislation stipulating that WSQ MUST BE USED then I will happily argue on your behalf that PNG is better in all respects for the application, if storage space is measured in cents rather than bits. If resistance to alteration is an issue, then stamp it with (say) 512 bit SHA-3, and if you can do undetectable alterations to that where equivalent alterations cannot be done to WSQ, then I will cheerfully agree that I am wrong. Until that happens, though, I'll be sleeping easy at night ;-)

Coincidentally, whilst trying to determine what security/verification features were part of WSQ (if any), I came across a more recent document (one decade old, vs two):
http://egovstandards.gov.in/sites/default/files/Fingerprint Image Data Standard Ver1.0.pdf that says:

5.4.3.1 For Normal Memory Devices
The fingerprint image captured during the enrolment process should be transmitted in lossless format (RAW, PNG or Lossless JPEG2000 ) from client system to the server for storage / archival in the standardized format for future usage.
so if PNG is good enough for our friendly Indian government officials (whom I understand to be the undisputed masters of bureaucracy ;-) then surely it's good enough for the rest of us in the real world where stuff needs to get done.
 

emexes

Well-Known Member
Licensed User
we're a small South African software company
Well, here's a curious coincidence - the distraction before was that I had to deliver my teenage son and his new girlfriend back to her home and parents, and they're from... guess where?!?! (just in case your morning caffeine is yet to kick in, the answer is: South Africa)

very strictly legislated. The WSQ format is one of the requirements
Perhaps it might be worth checking whether your local bureaucrats are keeping up with the Indians. I have plenty of people in my life telling me this, that and the other, like say, can you leave a child alone at home or in a car, and I often find there is mismatch between what I am told the legislation says, and what it actually says.

If you've already checked and WSQ is indeed stipulated by law, then just ignore that previous paragraph. But if it is your customers telling you this, then it might be worth a check. PNG is still the better choice if the legislation allows it and you are starting afresh, but if compatibility with legacy systems is a factor, then... well, I guess you're already exploring those tacks above.

Obviously, if you do find a good library, let us know, especially if it can do lots of other formats too.

Another thought is that you mentioned "converting regular images to WSQ format" and not the other direction. What was the reasoning for this? Like, I would have thought that if the fingerprint (card?) was captured by phone hardware or already in (lossy) JPEG format, then it's already below the quality implied by requiring WSQ format, so... if anything, converting it to WSQ is a backward step, by suggesting it is at a standard that it is not.

Hmm. Glad it's you sorting this out, and not me.

;-)
 

DonManfred

Expert
Licensed User

DonManfred

Expert
Licensed User
I would start trying with the free lib i posted above.
a short trying from Android.

B4X:
    File.Copy(File.DirAssets,"sample_image.wsq",File.DirInternal,"sample_image.wsq")
    nativeMe.InitializeContext
    Dim jo As JavaObject
    jo.InitializeStatic("org.jnbis.api.Jnbis").RunMethodJO("wsq",Null).RunMethodJO("decode",Array(File.Combine(File.DirInternal,"sample_image.wsq"))).RunMethodJO("toPng",Array()).RunMethodJO("asFile",Array(File.Combine(File.DirInternal,"sample_image.png")))
It crashes due to missing references. It is internal using Java AWT so it won´t work on Android. You may get it working in B4J...
 

DonManfred

Expert
Licensed User
a last 2 Cent comment ;-)

I do have AWT as problematic in mind. Maybe even in b4j it won´t work.
Based on
http://www.cognaxon.com/index.php?page=download_wsqlibrary
i can see that they do provide the Lib in many formats. Even one which can be used in Android. For B4A it needs to have a wrapper written for though.
They do provide the lib in many formats. The price of around $US 250 seems to be ok for such a security Library.
It should be easy to create a wrapper for it (you need to have some java knowledge though) which works on Android as they do provide native .so files for all relevant Abis. Even in 32 and 64 bit so the can theoretically work in future when google changes the requirement later this year.
 

DonManfred

Expert
Licensed User
A second last 2 cent comment :D

WSQ
...|http://www.b4x.com
Author: DonManfred
Version: 0.0
  • WSQ
    • Functions:
      • GenerateWSQLibrarySerialNumber As String
      • Initialize (EventName As String)
      • ReadImageFromFile (dimension As Int(), fileName As String) As Int()
      • ReadWSQ_bitrate As Double
      • ReadWSQ_comment As String
      • ReadWSQ_ppi As Int
      • SaveImageToFile (data As Int(), width As Int, height As Int, fileName As String, type As Int)
      • Set_Path_of_WSQ_library (path_of_WSQ_library As String)
      • UnlockWSQLibrary (authorization_code As String) As Int
      • WriteTIFFcompression (tiff_compression As Int)
      • WriteTIFFpredictor (tiff_predictor As Int)
      • WriteWSQ_bitrate (bitrate As Double)
      • WriteWSQ_comment (comment As String)
      • WriteWSQ_ppi (ppi As Int)
      • WSQ_decode_stream (input As Byte(), imageProperties As Int()) As Byte()
      • WSQ_encode_stream (input As Byte(), width As Int, height As Int, bitrate As Double, ppi As Int, comment_text As String) As Byte()

Download (due to the size of the native .so files) here (Filesize 1694KB): https://b4xcloud.de/dl/WSQV0.0.zip

You need to have a License from cognaxon.

It may crash though. I have no chance to test as i do not have a License ;-)
 
Last edited:

msains

Member
Licensed User
Thanks to you all for your generous answers, contributions and suggestions. In final wrap-up to your various queries etc ...
a) We need a bmp (or png) to WSQ function because the mobile device our clients have chosen can do a bmp fingerprint image
and the client webservice we must call (from the mobile in the field) requires the WSQ. (old fashioned I know)
b) The Cognaxon Library Developer price is OK (around $235) but their royalty deployment pricing is too steep.
c) If we come across a good library - I will certainly let the group know.
d) Thanks again for the kindness and expert comments and time
 

emexes

Well-Known Member
Licensed User
Webservice? Hmm. I somehow missed that online was an option. Haven't yet pulled that thread as hard as I can, but...

http://www.netxsolutions.co.uk/onlineWSQ.aspx

so close, no cigar (is in wrong direction) (now, why did that remind me of Bill Clinton???)

and... if royalty pricing is too steep, they have a "royalty free runtime licence" which sounds really great :)

http://www.netxsolutions.co.uk/androidPriceList.aspx

... provided that you're operating on a lot of devices :-/

Maybe setting up your own BMP --> WSQ conversion server is a possibility? (note singular: server, as in one, not many ;-)

There used to be a program Image Alchemy that did everything, but they appear to have closed up shop. Xnview says it handles WSQ and is free (donations accepted, though) but I downloaded it and couldn't find the save-as-WSQ bit. Irfanview also says it handles WSQ and is free... for non-commercial use. I wasn't up to downloading yet another test package. I've used Irfanview in the past, and it was competent then, so I'm assuming it still is.
 
Last edited:

emexes

Well-Known Member
Licensed User
Or perhaps straight from the horse's mouth:

https://www.nist.gov/services-resources/software/nist-biometric-image-software-nbis

which states:

The NIST Biometric Image Software ... ; it is freely distributed with no licensing requirements; and it is considered public domain.

The NBIS utilities fall under eight general categories:

A reference implementation of the ANSI/NIST-ITL 1-2007 (AN2K) "Data Format for the Interchange of Fingerprint, Facial, Scar Mark & Tattoo (SMT) Information" standard is included. This reference implementation contains a suite of utilities designed to read, write, edit, and manipulate files formatted according to this interchange standard.
...
Source code is provided for Baseline JPEG, Lossless JPEG, and the FBI's Wavelet Scalar Quantization (WSQ) encoders and decoders.
I realise we're somewhat adrift from your original quest for an Android library, but... if the fingerprints are already being shuffled about the internet, what's one more webservice between friends?!
 
Last edited:
Top