← All posts

Eye Scanning in 134 Lines: Learning What Biometric Systems Actually Need

2023CV · Python

Authentication sounds abstract until you reduce it to a webcam feed, a threshold, and a decision that can fail. That was the interesting part. Not building an iris scanner, but seeing how much of security is really pattern matching plus assumptions.

This started as a learning project. I wanted to understand whether a simple feature matching pipeline could be pushed into something that felt like authentication. The result was a small OpenCV prototype that enrolls an eye image, extracts ORB descriptors, stores them locally, and compares live captures against that reference.

Building the Core Loop

The whole system runs through a very simple sequence. Capture. Extract features. Save descriptors. Match a new scan against the saved template. Grant or deny.

ORB was the key decision. It was lightweight, accessible, and practical for a first attempt. I paired it with brute force matching using Hamming distance and used a crude threshold of more than ten good matches to authenticate. Simple logic, but enough to make the pipeline real.

That last detail mattered more than I expected. Counting matches alone looked convincing until bad matches started slipping through.

What Broke First

Reliability. Immediately.

Lighting changes threw off matching. Eye positioning mattered too much. Glasses could degrade results. The system worked just enough to expose why production biometric systems are much harder than a demo.

I also called it retina authentication at first, which was not technically accurate. It was closer to crude iris feature matching. That distinction matters.

What the Project Taught Me

The interesting lesson was not computer vision theory. It was thresholds. Hardcoded thresholds feel reasonable until they become the whole system's weakest assumption.

A value like distance below fifty or ten good matches looks harmless, but those numbers quietly define false accepts and false rejects. That was the first time I saw how even toy systems force you into security tradeoffs.

I also learned how much is missing when you ignore liveness detection, encrypted templates, preprocessing, or multi-user handling. The code worked. The system was incomplete.

What I Would Change

I would spend less time treating feature extraction as the hard part and more time improving the data before matching. Better normalization, guided eye alignment, and adaptive thresholds would have improved more than adding complexity.

I would also avoid storing raw descriptors locally without protection. For a learning project it was fine. For anything serious it is a flaw.

It was only 134 lines. That was enough to show how quickly simple demos run into real systems problems.

Small project. Big crack in the illusion that security is just code.

View all projects →View on GitHub ↗