L-1 Identity Solutions PIER™ 2.3 Emulation: How the Iris Scan Works
Contents
Introduction#
This is the third of three posts about the SecuriMetrics / L-1 Identity Solutions PIER™ 2.3 handheld iris scanner. Part 1 is the hardware teardown, part 2 covers the software on its CompactFlash card. This post is about the scan itself: how an image gets from the camera to an IrisCode, and how the device decides who it is looking at.
To watch that happen without opening the device again, I wrote an emulator for the PIER’s hardware.
It runs the original, unmodified PR167.EXE from the card in QEMU, including the camera, the FPGA frame grabber, the LCD and the keypad.
Every screen in this post is a screenshot from that emulator.
Two things make this safe to show:
- The eye in front of the emulated camera is synthetic. It is rendered procedurally and belongs to no one.
- The emulator runs on a copy of the card with an empty iris database. The real enrolment records on the card are never loaded, and the original dump stays untouched.
The walkthrough#
The video shows a complete cycle: power on, enrol an eye as “Jane Doe”, switch off, and identify the same eye in a new session the next day. The boot is sped up four times; everything else is real time in the emulator.
What the FPGA does, and what it doesn’t#
Next to the CPU sits a Xilinx Spartan-II XC2S100 (part 1). In a device that does iris recognition, I expected the FPGA to do the heavy image processing: filtering, segmentation, perhaps the wavelet transform for the IrisCode. It does none of that. The FPGA is a frame grabber. It takes the pixel stream from the camera and writes each frame into the CPU’s memory over PCI as a bus master, then raises an interrupt.
That is clear from the firmware (the register details are below):
- It is configured from the card at every boot. A Spartan-II has no flash; its configuration is lost at power-off.
PR167.EXEreadsISB8VERY.BIT(named inNET167.INI), skips the bitstream header up to the first0xFFand shifts the data out one bit at a time to I/O port0x280, Xilinx’s slave-serial mode. - The design is a PCI core. The 97,732-byte bitstream is a design called
pci_top_routed.ncdfor a2s100tq144, built on 2003-11-21 (header dump in part 2). - The camera is not even configured through it. The CPU sets up the OV7120 sensor over I²C itself.
The firmware also contains the PCI bring-up tests the developers used for the FPGA: target and bus-master tests, a data ramp written to the FPGA and read back, interrupt tests and a throughput test. None of them touches image processing.
In hindsight this makes sense. The XC2S100 has 2,700 logic cells, 40 Kbit (5 KB) of block RAM and no dedicated multiplier blocks, only carry logic that helps to build them from logic cells. A single frame is 300 KB, so the FPGA cannot even hold one; its block RAM is just enough to buffer a few lines on their way to PCI. The Élan SC520 has a PCI bus but no camera interface, so something has to turn the sensor’s pixel clock into PCI writes, and a small FPGA is the cheap way to do that.
Everything else runs in software on the 133 MHz Am5x86 core, with its floating-point unit.
The application’s symbol table shows the pipeline: image processing (IMGPROC), pupil and iris localisation (PUPCENTR, IRISLOCA), eyelid detection (EYELIDSP, eyelidspline2pi), focus measures (FFOCUS, framefocus2pi, checkFocus) and the enrolment and recognition workflow (GETICODE, XENROLL, XRECOG).
The encoding and matching core is the separate IRIS2PI.DLL, which exports _TWOPI_ENROLL, _TWOPI_FOCUS and _TWOPI_RECOG (part 2).
The “2pi” in these names fits L-1’s name for its algorithm, the “L-1 Daugman 2Pi algorithm”.
How a scan works#
The camera is the OV7120 described in part 1, a 640 × 480 monochrome sensor behind a 16 mm lens.
The eye is lit by LEDs at two near-infrared wavelengths (LedLow=780 and LedHigh=860 in MACHINE.INI, presumably nm).
In near-infrared even dark brown irises show their texture, and the two LEDs show up as small bright reflections on the cornea.
A scan has three phases.
1. Preview and image collection#
While the operator holds F2 (or keeps a finger on the touch screen), the device streams frames to the LCD and evaluates every one of them.

The preview screen shows:
- The camera image, scaled down, with a crosshair for aiming.
- F, a focus measure. In my tests it dropped below 20 % when the hand drifted out of the depth of field and climbed back to 99 % when the eye was sharp.
- Two bars at the sides. They start red and turn green once enough good images are available.
- “Images avail”: the number of usable images collected so far.
- N, the number of frames grabbed so far, and two more values, T and S (a percentage), whose meaning I haven’t worked out.
- An intensity profile below the image: a plot through the eye. The dips are the pupil and the iris.
Not every capture is accepted.
In early tests my synthetic eye had too little contrast between iris and sclera and too many blurred frames.
The device then printed ENROLL: WEAK_LIMBUS and ENROLL: ERROR_POOR_FOCUS on its debug serial port (COM2), showed “Fail POOR IMAGES” and started over by itself.
Other failure messages in the firmware are “LOW TEXTURE” and “TOO FEW IMAGES”.
The configuration suggests acquiring sets of up to six images and requiring at least three good ones; the settings are commented out in NET167.INI, but three is what the preview waits for.
2. Segmentation and the IrisCode#
From the best frames, the software finds the pupil, the outer edge of the iris (the limbus) and the eyelids. In Daugman’s method, which L-1’s algorithm is named after, the iris ring is then unrolled into a rectangle (“rubber sheet” normalisation) and filtered with 2D Gabor wavelets. The sign of each filter response becomes one bit of the IrisCode; Daugman’s code has 2,048 of these phase bits (256 bytes), plus as many mask bits that mark the bits hidden by eyelids, lashes or reflections. The result screen draws the segmentation over the image: the circles around the pupil and the iris.
3. Matching#
To identify a person, the new IrisCode is compared with every stored one. The measure is the Hamming distance: the fraction of bits that differ, counting only bits that are valid in both codes, at the best of several rotations to allow for a tilted head. Two images of the same eye typically differ in 10–30 % of the bits; codes of different eyes differ in about half, like coin flips. In Daugman’s 2004 paper the decision criterion is “slightly below 0.33”.
Enrolment#
With an empty database, the enrolment of “Jane Doe” goes like this:
- F4 (Enroll), then hold F2. The device collects images as above.
- “Verify eye? [YNR]”. Answering Y first checks the database for a duplicate. The answer is “Eye is new unknown”.
- “Enroll eye? [YN]”.
- A short form: last name, first name, which eye (
RorL) and an ID number, typed on the keypad. - “All OK? [YN]”, then “Generating long iris code”.
- A menu to enrol the other eye, continue later, or stop.

After that, the two database files on the copy of the card have grown by exactly one record each: 128 bytes in RECFIL1K.F02 (name, eye, ID) and 1,024 bytes in MASTER1K.F02 (the iris template, see part 2).
“Long codes” are the default since software version 1.66 (hhLongCodes=1); the older short format used 64-byte records.
Tethered and standalone mode#
The card as I received it runs in tethered mode (hhTetheredMode=1).
In that mode the device skips the form: an enrolment ends with “Enroll: SUCCESSFUL”, but nothing is written to the card.
The database files keep their size and date, and a recognition on the device alone does not find the person.
Presumably the host PC collects the enrolment over the network, using the protocol described in part 2.
For the walkthrough I set hhTetheredMode=0 in the copy’s NET167.INI, so that the device asks for the person’s data and stores the record itself.
Identification#
The next day, a new session: F3 (Recog), hold F2, and after about a second the device answers.

The screen lists the matched record and the details of the comparison:
| Field | Value | Meaning |
|---|---|---|
rec | 0 | Index of the matching record |
hd | 0.10 | Hamming distance, normalised (see below) |
nbit | 1021 | Number of bits compared (valid in both codes) |
bdif | 120 | Number of differing bits |
irad | 93 | Iris radius, probably in pixels |
ipct | 96 | Probably the percentage of the iris that was usable |
qual | 1.79 | A quality score |
The meanings of irad, ipct and qual are my interpretation, guided by the quality values the firmware reports internally (part 2); the other fields follow from the numbers.
hd is not simply bdif / nbit, which would be 120 / 1021 = 0.118.
It matches the normalisation Daugman uses to make scores comparable when different numbers of bits are compared:
HD_norm = 0.5 - (0.5 - HD_raw) * sqrt(nbit / 911)
= 0.5 - (0.5 - 0.1175) * sqrt(1021 / 911) = 0.095 -> 0.10
This is equation (6) in Daugman’s 2006 paper, with 911 bits as the reference: a comparison based on fewer valid bits is pulled towards 0.5, the value for unrelated eyes. A second run with 178 differing bits out of 1,042 gives 0.148; the device showed 0.15.
The emulator#
The emulator is a single device for QEMU 10.2, about 800 lines of C, that adds the PIER’s hardware to QEMU’s standard PC. That works because the PIER is a PC at heart: an x86 CPU, a PC-compatible BIOS and DOS. Everything the application needs beyond that was found in its code:
| Part | What the application does | What the emulator provides |
|---|---|---|
| SC520 configuration registers | Uses them at 0xDF000, presumably an alias of the SC520’s memory-mapped configuration region (MMCR) set up by the BIOS, for its GPIO pins | The GPIO data, set and clear registers; the rest behaves like memory |
| I²C bus | Bit-banged on GPIO: SCL and SDA out on PIO17/18, read back on PIO10/12 | A bus decoder with START/STOP, ACK and clock-stretching reads |
| Camera | OV7120 at I²C address 0x21 (0x42 as the 8-bit write address): reset and configuration | A register file that accepts the setup |
| Keypad | 5 × 6 matrix on two PCF8574 expanders (0x20 columns, 0x25 rows), ENTER and SHIFT wired directly | The PC keyboard, mapped onto the matrix |
| Power | PCF8574 at 0x22: switches the camera on and takes the shutdown command | An expander that accepts the commands |
| ADC | MAX1039 at 0x65: battery, DC input, charge, temperature (volts = reading / 37.4) | A battery reading of 160 (4.28 V on the firmware’s scale) and no charger |
| Touch panel | TSC2003 at 0x48 | The mouse |
| LCD | Epson S1D13706 at physical 0x14000000: registers, palette, 240 × 320 × 8-bit frame buffer | A QEMU display that uses the real palette |
| Frame grabber | The FPGA, see below | Bitstream loading, the register window, DMA of the camera frames, IRQ 12 |
The frame grabber#
The application maps the FPGA’s registers at physical 0xDE000, directly below the 0xDF000 window.
To start a capture, it writes the buffer address to offset 0x340, a start bit to 0x000 and a “go” bit to the interrupt register at 0x3C0.
When the frame is in memory, the FPGA sets bit 0x100 (“done”) in the interrupt register, or 0x200 on an error, and raises IRQ 12.
The interrupt handler acknowledges by writing the bit back.
The frame format is plain: 640 × 480 pixels at 8 bits, either progressive or as two fields of 640 × 240 where the second one starts at offset 0x25800.
Software interleaves the fields and applies a gamma table.
The synthetic eye#
The camera of the emulator plays a 20-second loop of 640 × 480 frames at 15 frames per second, rendered with NumPy:
- The iris is generated in polar coordinates from a fixed random seed: radial fibres, crypts, a wavy collarette, contraction furrows, the dark ruff at the pupil and the darker limbal ring. The same seed always gives the same “person”.
- The eye around it: a shaded sclera with faint vessels and a caruncle in the inner corner, skin with pores and a lid crease, tapered upper and lower lashes, and the two LED reflections on the cornea.
- The hand holding the device: slow drift and tremor, small rotations, and changes in distance that move the eye in and out of the depth of field. Each frame is exposed over three sub-steps for motion blur, then gets sensor noise and vignetting.
- The eye itself: small gaze shifts and blinks with realistic timing: the lid closes in about 90 ms, stays closed briefly and opens more slowly.



My first identification test showed hd=0.00.
The emulator is deterministic, and day 2 had replayed exactly the same camera frames as day 1.
A real second visit is never identical, so for day 2 I rendered a new take of the same synthetic eye: different hand movement and blinks, a smaller pupil as in a brighter room, a slightly different gaze angle and contrast.
That gave the realistic distances of 0.10 and 0.15.

What was harder than expected#
- My first guess of the I²C pins was wrong. A trace of the GPIO writes showed SCL and SDA swapped: read as pairs of “set” and “clear” values, the sequence only became a valid START condition with the pins the other way round.
- QEMU’s own BIOS (SeaBIOS) keeps data in the same memory area as the FPGA window and hung at boot until the window behaved like ordinary memory outside its few real registers.
- The application polls the keypad only every few hundred milliseconds, so short simulated key presses got lost.
- The LCD palette is written through a data port: three colour registers, then an index register that commits them. Capturing that wrongly made the boot screen dark blue instead of white.
Conclusion#
The most surprising finding for me is how little of the iris recognition is in hardware. The FPGA, which I took for the “smart” part of the board, is a PCI frame grabber. Segmentation, quality checks, IrisCode generation and matching against the database all run in software on a 133 MHz 486-class CPU, fast enough that a match appears about a second after the operator lets go of the button, at least in the emulator.
With the emulator, the PIER can be explored without its battery, its camera or a real eye. The next steps are a working network card, so the host protocol can be tested, and a look at the remaining setup screens.
Sources#
- John Daugman, How Iris Recognition Works [cam.ac.uk], IEEE Transactions on Circuits and Systems for Video Technology 14(1), 2004
- John Daugman, Probing the Uniqueness and Randomness of IrisCodes: Results From 200 Billion Iris Pair Comparisons [cam.ac.uk], Proceedings of the IEEE 94(11), 2006
- Xilinx, Spartan-II FPGA Family Data Sheet (DS001) [pdf]
- AMD, Élan™ SC520 Microcontroller User’s Manual [pdf]
- Epson, S1D13706 product page
- QEMU 10.2
- The PIER’s CompactFlash card:
PR167.EXE(PV11 release v1.67, 06-Dec-2007) with its CodeView symbols,NET167.INI,MACHINE.INI,ISB8VERY.BIT(see part 2)