mhshams / jnbis

NIST Biometric Image Software (Java Implementation)
Apache License 2.0
104 stars 72 forks source link

how to convert file between wsq and png format #17

Closed thisisnottaken closed 6 years ago

thisisnottaken commented 6 years ago

sir , I am a newbie. Please find attached the log after running mvn package 31-mvn-package-in-jnbis.txt

My aim is to convert wsq file to png and vice versa. i saw https://github.com/kareez/jnbis/blob/develop/README.md

Still , am unable to figure out . How to use the lines below ?

File png = Jnbis.wsq() .decode("path/to/wsq/file.wsq") .toPng() .asFile("/path/to/final/file.png");

All I understand is that I will put absolute file path for input and output in above. But how to run the above command ?

Thanks.

ericdsoto commented 6 years ago

thisisnottaken,

You need to create a Java class with that code and then compile and execute it.

One very simple example might be the following:

import org.jnbis.api.Jnbis;
import java.io.File;

public class JnbisExample {
    public static void main(String[] args) {
        File png = Jnbis.wsq()
                .decode("path/to/wsq/file.wsq")
                .toPng()
                .asFile("/path/to/final/file.png");

        // do something with png file
    }
}

I hope this helps. Good luck! -Eric

thisisnottaken commented 6 years ago

i saved above as JnbisExample.java and ran java JnbisExample.java Got 'Error: Could not find or load main class JnbisExample.java'

ericdsoto commented 6 years ago

You first need to compile the Java class using the Java compiler, javac. (Note the c at the end of the command.) Something like:

javac -classpath /path/to/library/jnbis-2.0.0.jar JnbisExample.java

That will generate a JnbisExample.class file which you then can execute with the following command:

java -classpath ./:/path/to/library/jnbis-2.0.0.jar JnbisExample
thisisnottaken commented 6 years ago

sir , That works. Thanks a lot .

Is it possible to get wsq from png ?

ericdsoto commented 6 years ago

I'm glad it worked.

The JNBIS was developed to extract and decode NIST files and, as such, does not currently include the functionality of encoding image files into NIST format.

You might want to check out this link which contains the NBIS software on which JNBIS is based. Specifically, you might be interested in the WSQ encoder.

I hope this helps. Good luck!

-E.

thisisnottaken commented 6 years ago

Got it . Installed nbis5_0_0 . Can you tell which binary does png to wsq and vice versa among

an2k2iaf bozorth3 cjpegb datainfo djpegl dwsq histogen lintran mlp oas2pics pcasysx rwpics wrwsqcom an2k2txt chgdesc cjpegl diffbyts djpeglsd dwsq14 iaf2an2k meancov mlpfeats optosf rdimgwh sd_rfmt ycc2rgb an2ktool chkan2k cmbmcs djp2k dlwsqcom eva_evt intr2not mindtct nfiq optrws rdjpgcom stackms znormdat asc2bin cjp2k cropcoeff djpeg dpyan2k fing2pat jpegtran mkoas nfseg optrwsgw rdwsqcom txt2an2k znormpat bin2asc cjpeg cwsq djpegb dpyimage fixwts kltran mktran not2intr pcasys rgb2ycc wrjpgcom

ericdsoto commented 6 years ago

I am not terribly familiar with the binaries but my best bet would be to try the an2ktool under the an2k directory.

an2ktool - Parses, manipulates, and/or writes the results to an ANSI/NIST 2007 file in batch mode.

You could also look under imgtools for any binary that contains "wsq" in the name.

Finally, you can check out the man directory which contains a text (manual) file for each binary.

Best of luck!

ericdsoto commented 6 years ago

From page 15 of: https://ws680.nist.gov/publication/get_pdf.cfm?pub_id=51097

IMGTOOLS also contains a collection of standard compliant and certifiable image encoders and decoders. The utilities cjpegb and djpegb encode and decode Baseline JPEG files respectively. The utilities cjpegl and djpegl encode and decode Lossless JPEG files. This represents one of the only available implementations of the standard Lossless JPEG algorithm. Finally, the utilities cwsq and dwsq encode and decode FBI WSQ files. An X Window application, dpyimage, is provided to view these different file compression formats, including IHead images and raw pixmaps.

Ortega-Dan commented 3 years ago

From page 15 of: https://ws680.nist.gov/publication/get_pdf.cfm?pub_id=51097

IMGTOOLS also contains a collection of standard compliant and certifiable image encoders and decoders. The utilities cjpegb and djpegb encode and decode Baseline JPEG files respectively. The utilities cjpegl and djpegl encode and decode Lossless JPEG files. This represents one of the only available implementations of the standard Lossless JPEG algorithm. Finally, the utilities cwsq and dwsq encode and decode FBI WSQ files. An X Window application, dpyimage, is provided to view these different file compression formats, including IHead images and raw pixmaps.

I confirm, this message actually helps to do the job. If compiled, those binaries will help (with 8bit depth jpegs), and corresponding man pages are very helpful.

gusciri commented 5 months ago

Hi Eric, I'm running into an error while processing a specific image: ArrayIndexOutOfBoundsException: Index 32767 out of bounds for length 32767 at: org.jnbis.internal.WsqHelper$Token.readByte(WsqHelper.java:164)

Other images are working fine.

Thanks!