Scan - fotojockovic.com/scan ============================ A document scanner that runs entirely in the browser: page detection, perspective and curve correction, shadow removal, filters, B&W binarisation, signature extraction, PDF writing and (optional) text recognition. No image leaves the device. Our own work (MIT licence, source in src-rs/ and the .js files in this folder): - scankernel (Rust -> WebAssembly, wasm/scankernel*.wasm): colour structure-tensor edges, orientation-constrained Hough transform, quad search and scoring, sub-pixel edge refinement with local corner tangents, true-aspect estimate from the camera geometry (after Zhang & He, "Whiteboard scanning and image enhancement", 2007), homography + Coons-patch dewarping, paper-colour flattening (shadow / uneven light removal), the filters, Sauvola-style adaptive binarisation (after Sauvola & Pietikainen, 2000), signature extraction, 1-bit packing. - The candidate ranker (wasm/ranker.bin, a linear scoring model over 48 measurements per quad: edge support, contrast, drop shadow, texture, shape, nesting between candidates, agreement across scales...): picks the page among the quads the detector proposes at three scales. Trained by us only on synthetic scenes that we rendered from the public-domain / CC0 images listed below; released under the same MIT licence as the code. (We also trained a small page-segmentation network, "PageNet", whose inference code is still in src-rs/src/pagenet.rs; on our measurements it did not improve detection, so no network weights are shipped and it is not used.) - The camera stage (WebGL2), PDF writer (with a glyph-less TrueType font generated in pdf.js for the invisible OCR text layer), ZIP writer, the UI and texts. Shipped third-party software (all optional, loaded only when "Searchable text" is switched on), in tess/: 1. tesseract.js 7.0.0 (tesseract.min.js, worker.min.js) - Apache License 2.0, (c) Jerome Wu and contributors. https://github.com/naptha/tesseract.js Licence: tess/LICENSE-tesseract.js.md 2. tesseract.js-core 7.0.0 (core-7.0.0/*.wasm.js): Tesseract OCR compiled to WebAssembly - Apache License 2.0 (Tesseract: Google / tesseract-ocr contributors; Leptonica: BSD-2-Clause, Dan Bloomberg). https://github.com/naptha/tesseract.js-core Licence: tess/core-7.0.0/LICENSE 3. Language models (lang-4.0.0_best_int/*.traineddata.gz): tessdata (4.0.0 "best", integerised as distributed by tesseract.js) - Apache License 2.0, https://github.com/tesseract-ocr/tessdata_best eng, srp (Cyrillic), srp_latn, hrv, deu, fra, spa, ita, rus, ell, pol, nor, swe, dan, hun, ces. Demo photo (demo/letter.jpg, resized; also used in og.jpg): "Charles Édouard Lardy Letter page one" by John Jason Junior, Wikimedia Commons, own work, CC0 1.0 (the 1887 letter itself is public domain by age). https://commons.wikimedia.org/wiki/File:Charles_%C3%89douard_Lardy_Letter_page_one.jpg Images used only to TRAIN the ranker and to TEST the detector (not shipped): - Page scans: public-domain documents from Wikimedia Commons and the Internet Archive (US government documents, 19th/early-20th century letters, books, newspapers, forms, receipts), one CC0 receipt photo. - Surfaces: Poly Haven textures (CC0 1.0, https://polyhaven.com/license) and ambientCG materials (CC0 1.0, https://docs.ambientcg.com/license); CC0 desk/table photos by their own photographers on Wikimedia Commons. - Test-only real photos with ground-truth corners: SmartDoc 2015 Challenge 1 (Burie et al., ICDAR 2015; CC BY 4.0) and MIDV-500 / MIDV-2019 (Arlazarov et al.; CC BY-SA 2.5). Used for measurement only; nothing from these datasets is shipped or was used for training. Plus 54 CC0 / public-domain document photos from Wikimedia Commons (own work of their photographers) whose page corners we annotated by hand, test only. Fonts from Google Fonts (self-hosted), SIL Open Font License 1.1: Inter Tight (Rasmus Andersson et al.), Instrument Serif (Instrument). Language flags (/static/tools/common/i18n.js): our own simplified drawings; translations of the interface are our own. No GPL/AGPL code is shipped. Self-hosted web fonts (2026-10-19): Inter Tight, Instrument Serif. SIL Open Font License 1.1. The woff2 files are the ones Google Fonts serves (latin, latin-ext, cyrillic, greek subsets where the family has them), stored on our own server under /static/tools/common/fonts// with each family's licence text (OFL.txt) next to them; stylesheet /static/tools/common/fonts/ui.css. No font request goes to Google.