ivosh / node-nist

A simple low-level ANSI/NIST-ITL 1-2011 (update 2015) encoding and decoding utility library. Written in Typescript for Node.
MIT License
12 stars 6 forks source link

WSQ image dimensions #1

Open Edza opened 4 years ago

Edza commented 4 years ago

Hi,

Noticed this comment: // :TODO: should be determined automatically from WSQ image const getHorizontalScanningLine = (): string => '500'; // :TODO: should be determined automatically from WSQ image const getVerticalScanningLine = (): string => '750';

What way would you recommend to implement this?

ivosh commented 4 years ago

I have a solution for this somewhere. Let me dig it out in the next couple of days. Feel free to ping if there is no response in 2 weeks.

Edza commented 4 years ago

Great! Thanks

Edza commented 4 years ago

Looks like .wsq files have dimensions encoded in them:

PIX_WIDTH 320 PIX_HEIGHT 480 PIX_DEPTH 8 PPI 500 LOSSY 1 COLORSPACE GRAY COMPRESSION WSQ

Maybe a simple extraction would be with regex?

ivosh commented 4 years ago

I have pushed the initial image header detection stuff in version 0.5.0 (https://github.com/ivosh/node-nist/commit/4fd18c90de194f6c025e683b48d4ada5b1cd4bc4).

I still need to work on integrating this into NistEncodeOptions and examples.

Edza commented 4 years ago

I tried to search for the WSQ spec and did not find if PIX_WIDTH and HEIGHT are mandatory in WSQ files. There was a mention of a WSQ meta file... is there any specification that you are using?

ivosh commented 4 years ago

WSQ specification goes under the following name WSQ GRAY-SCALE FINGERPRINT IMAGE COMPRESSION SPECIFICATION. Googling it up leads for example here: https://www.fbibiospecs.cjis.gov/Document/Get?fileName=WSQ_Gray-scale_Specification_Version_3_1_Final.pdf

However PIX_WIDTH and others you were referring to form a part of specially formatted comment block called NISTCOM. I don't have any authoritative source for it, but have a look for example here: https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir6813.pdf

Edza commented 4 years ago

Could you please share the width/height calculating code?

ivosh commented 4 years ago

The code is already here: https://github.com/ivosh/node-nist/blob/master/src/imageHeader.ts

Unfortunately I did not have time to update tests, examples and README to use it.