In order to populate a database with artificial but semantically valid contents, sometimes we need to obtain random values.Considering PostgreSQL DBMS, in the case of generating DATE type values, we could create a customized function, named gen_date(), which receives the lower bound for the date to be created as argument:CREATE OR REPLACE FUNCTION gen_date(min date) RETURNS date AS $$ SELECT CURRENT_DATE - (random() * (CURRENT_DATE - $1))::int;$$ LANGUAGE sql STRICT VOLATILE;The following instruction is able to check the function results:SELECT gen_date('1980-01-01'), gen_date('2015-12-31'); gen_date | gen_date ------------+------------ 2003-03-08 | 2016-01-20(1 record) This series of articles aim at evaluating NBIS biometric software by using it against fingerprint image databases from FVC2004 verification competition.WARNING: If you have not yet read the first article, I hardly suggest you to do so: Evaluating NIST Biometric Image Software (NBIS) using FVC2004 Databases - Part 1.Considering you have already followed the steps made in the first article, which included installing NBIS and downloading FVC2004 databases, open a terminal and type these commands:source nbis-env.shcd images/3. Lights, camera, action!3.1. Converting TIFF images to WSQ formatThe first step on our biometric journey is to convert fingerprint image files into a format called WSQ (Wavelet Scalar Quantization) [11]. The WSQ algorithm is based on wavelet theory and has become a standard for the exchange and storage of fingerprint images. It was developed by the FBI, the Los Alamos National Laboratory, and the National Institute of Standards and Technology (NIST).NBIS provides a tool called CWSQ to compress grayscale fingerprint images using WSQ algorithm. We'll use it in this section.In our case of FVC2004 databases, fingerprint image files are offered in TIFF format. We'll select a single one to test NBIS tools: "db1/101_1.tif". You could display this fingerprint image by issuing (or your preferred image viewer):qiv db1/101_1.tifAs the image is in TIFF file format, we need to know its dimensions before invoking CWSQ. Therefore, type this:identify db1/101_1.tifdb1/101_1.tif TIFF 640x480 640x480+0+0 8-bit Grayscale DirectClass 308KB 0.000u 0:00.009The command output means that the image we chose is really a TIFF format, has 640 of width and 480 of height in pixels, and is in 8-bit Grayscale.Finally, call the CWSQ program using these arguments (.75 stands for a 15:1 compression rate):cwsq .75 wsq db1/101_1.tif -r 640,480,8If successful, it will produce a new file with the extension ".wsq" (11 kB) in the same directory of the ".tif" (301 kB) file:ls -la db1/101_1.*NBIS provides a WSQ viewing tool called DPYIMAGE. Try running it to see the resulting WSQ file:dpyimage db1/101_1.wsqOnce we could convert a single TIFF image into a WSQ specific format, let's do the same throughout all four FVC2004 databases. As each database has distinct dimensions, we need to specify them separately:find db1/ -name "*.tif" -exec cwsq .75 wsq {} -r 640,480,8 \;find db2/ -name "*.tif" -exec cwsq .75 wsq {} -r 328,364,8 \;find db3/ -name "*.tif" -exec cwsq .75 wsq {} -r 300,480,8 \;find db4/ -name "*.tif" -exec cwsq .75 wsq {} -r 288,384,8 \;You can verify whether all WSQ files were created by issuing this command:find -name "*.wsq" | head./db1/108_4.wsq./db1/109_2.wsq./db1/102_2.wsq./db1/109_5.wsq./db1/101_4.wsq./db1/104_4.wsq./db1/104_8.wsq./db1/103_2.wsq./db1/110_4.wsq./db1/109_8.wsq3.2. Checking quality of WSQ images through NFIQAnother