LANVAR
← The shelf

PDF image locator

Did its thing

Find where an image lives inside a textbook PDF — by matching pixel matrices directly, because OCR kept getting it wrong.

✳ Best Educational Hack · McHacks 9 PythonAlgorithms 2022
How it actually works
TEXTBOOK PDF · 1,208 PAGES QUERY → pixel matrix MATCH MONITOR TILE SWEEP SIMILARITY 0.34 0.98 0.98 STATUS SCANNING… LOCKED LOCKED FOUND · p.142 FOUND · p.142 no OCR anywhere — slide the pixels until the matrices agree
FIG 1 · the hunt, animated — a pixel window marches the page till the matrices agree
query image → pixel matrix textbook pages → pixel matrices direct matrix match custom algorithms, runtime far below the naïve scan found it page & location ✗ no OCR — that's exactly what everyone else got wrong McHacks 9 · 36 hours · Best Educational Hack
FIG 2 · the machinery — two pixel matrices walk into a matcher
The story

McHacks 9, 36 hours, team MAAG: Matthew Cabral, Abhijeet Praveen, and Gianluca Piccirillo. The problem — existing tools for finding an image inside a textbook lean on OCR and miss constantly.

The fix was to skip character recognition entirely: represent both the query image and the PDF pages as matrices of pixels and match them directly, with custom algorithms to keep runtime far below the naïve scan-everything approach. Accurate enough and fast enough to win Teacher’s Pet, the best-educational-hack award.