How PopiScan Works: In-Browser Privacy & Mathematics
A comprehensive guide explaining how PopiScan processes photos entirely inside your device's browser sandbox, the computer vision algorithms powering face detection and consent matching, and why zero biometric data ever leaves your computer.
You can test this right now: open PopiScan, turn on Airplane Mode or disconnect your Wi-Fi, and drag an album of 50 photos into the scanner. PopiScan will detect faces, identify consent conflicts, and generate blurred/pixelated downloads with zero internet connectivity.
π How PopiScan Stays 100% In-Browser: The Sandbox Architecture
Modern web browsers enforce strict security boundaries known as the Web Application Sandbox. PopiScan leverages this architecture to create an ironclad privacy perimeter around your media files:
-
Volatile Memory Execution (RAM Only): When photos are dropped onto the interface, they are parsed via the browser's native
FileReader.readAsDataURL()andURL.createObjectURL()interfaces. The binary data is held temporarily in browser memory and is freed via JavaScript garbage collection as soon as the tab is closed or cleared. No temporary files are written to server hard drives. -
Origin-Isolated Storage (Zero Cloud DB): Your POPIA Consent Registry (the names, legal statuses, and IDs of students, staff, or attendees) resides exclusively inside the browser's
window.localStoragepartition. This storage is keyed to your origin (popiscan.co.za) on your physical machine. We do not have a user account system, a remote SQL database, or an administrative backend. - Zero Egress Network Boundary: The PopiScan web server is an ultra-lean Alpine Nginx static server whose only function is serving pre-compiled HTML, CSS, and JS files on initial page load. Once loaded into your browser, PopiScan initiates 0 HTTP POST, PUT, or WebSocket connections. There are no analytics trackers, no advertising beacons, and no telemetry pings.
π Algorithm 1: Viola-Jones Detection & The Integral Image Transform
Real-time face detection on high-resolution event photographs (e.g., 24-megapixel DSLR shots) would grind an average laptop or phone to a halt if evaluated pixel-by-pixel. PopiScan solves this using an optimized client-side implementation of the Viola-Jones Object Detection Framework with Haar-like Cascade Classifiers (via tracking.js).
Here is the exact mathematics enabling this pipeline to process millions of pixels in milliseconds:
The Solution: In a single pre-processing pass, PopiScan converts the canvas image into an Integral Image $II(x,y)$, where each coordinate stores the sum of all pixels above and to the left of $(x,y)$.
Using the recurrence relations below, the Integral Image is constructed in a single linear $O(N)$ sweep across the image buffer:
Haar-Like Contrast Features:
Human faces share universal biological lighting signatures: the bridge of the nose is consistently brighter than the flanking eye sockets, and the upper forehead is brighter than the brow ridge. PopiScan applies rectangular Haar wavelet filters:
- Two-Rectangle Filters: Measures the differential contrast $f = \sum_{\text{dark}} I - \sum_{\text{light}} I$ between horizontally or vertically adjacent bands.
- Three-Rectangle Filters: Computes the difference between a central strip and two surrounding regions (ideal for the nose bridge and eye line).
- Four-Rectangle Diagonal Filters: Evaluates diagonal shear transitions across cheekbones and jaw contours.
These classifiers are structured as a degenerate decision tree cascade: Stage 1 uses just 2 Haar features to reject ~50% of non-face background windows in sub-microsecond time. Over 99% of background candidates are rejected within the first 3 stages, dedicating CPU power only to genuine face candidates.
π§ Algorithm 2: Biometric Vector Embeddings & Hypersphere Metric Learning
For advanced identity matching across the consent roster, PopiScan's codebase stages deep convolutional feature extractors (via face-api.js MobileNet / ResNet-34 backbones running via WebGL/WebAssembly).
Rather than storing sensitive facial photos, modern neural architectures convert facial geometry into a compact mathematical point in a high-dimensional vector space:
The feature extractor is trained using the Triplet Margin Loss function, which enforces that biometric vectors of the same individual cluster tightly together while pushing different individuals far apart:
Identity Verification via Metric Distances:
When matching detected faces against the local consent roster, PopiScan compares the extracted vector $\mathbf{u}$ against enrolled vectors $\mathbf{v}$ using Euclidean Distance and Cosine Similarity:
π¨ Algorithm 3: Canvas Redaction Mathematics & Irreversible Anonymization
When a subject is flagged as RESTRICTED (e.g. parental consent withheld under POPIA Section 35), PopiScan allows one-click privacy sanitization directly onto the HTML5 Canvas before exporting. The math behind each redaction mode ensures irreversible anonymization:
ctx.fillRect() to directly overwrite the underlying Uint8ClampedArray memory buffer. The original pixel data is completely destroyed in RAM before the sanitized image is compiled via canvas.toDataURL('image/jpeg', 0.92). Because the original bytes no longer exist in the exported file, no algorithmic "unblurring" tool or inverse neural network can ever recover the redacted face.
βοΈ Architectural Comparison: PopiScan vs. Cloud-Based Vision APIs
The table below contrasts PopiScan's browser-first model against conventional cloud-hosted artificial intelligence services (such as AWS Rekognition, Google Cloud Vision, or Azure Face API):
| Compliance & Security Vector | PopiScan (Client-Side) | Cloud AI APIs (AWS / Google / Azure) |
|---|---|---|
| Photo Ingestion & Egress | Zero Upload β Stays in local RAM | Full Ingestion β Photos uploaded over WAN |
| Server-Side Storage Risk | 0 Bytes β No database or storage bucket | High β Images cached in cloud object storage |
| POPIA Section 19 Breach Exposure | Zero Attack Surface β Nothing to breach | Severe β Centralized cloud honeypot vulnerability |
| POPIA Section 35 (Child Biometrics) | Protected β Minors' photos never leave custody | High Risk β Third-party processing of special data |
| POPIA Section 72 (Cross-Border Transfer) | 100% Domestic β Executes on user's device | Non-Compliant unless strict adequacy agreements exist |
| Offline Capability | Full Offline β Works in Airplane Mode | None β Requires active high-speed internet |
| Cost & Metering | 100% Free & Open Source (GPLv3) | Per-Image API Billing ($1.00 β $2.50 per 1,000 scans) |
πΏπ¦ Legal Grounding Under POPIA (Act 4 of 2013)
PopiScan was specifically engineered to address the statutory obligations imposed upon schools, religious institutions, athletic clubs, and corporate event organizers under South African privacy law:
- Section 19 (Security Measures on Integrity and Confidentiality): Responsible Parties are legally obligated to secure personal information against unlawful access, destruction, or disclosure. By processing photos strictly on the user's hardware without intermediate cloud relays, PopiScan completely removes the risk of cloud database leaks, employee credential theft, or S3 bucket exposure.
- Section 35 (Prohibition on Processing Personal Information of Children): Section 35 strictly forbids the processing of personal and biometric information concerning a minor child unless carried out with the prior consent of a competent person (parent or legal guardian). PopiScan enables administrators to identify and sanitize opted-out children before event albums are published, without ever exposing those children's photos to third-party cloud infrastructure.
- Section 72 (Transborder Information Flows): Transferring biometric data outside the Republic of South Africa requires satisfying stringent statutory conditions (such as binding agreements or foreign privacy adequacy). PopiScan performs 100% of calculations within your local machine, completely eliminating cross-border data transfer liabilities.
π How to Verify PopiScan's Privacy Guarantee Yourself
You do not need to take our word for it. PopiScan is designed to be fully verifiable by any privacy officer, IT administrator, or security auditor in under 60 seconds:
- Open Browser Developer Tools: Press F12 (or Ctrl + Shift + I on Windows/Linux, Cmd + Option + I on Mac).
- Switch to the Network Tab: Click on the Network tab in Developer Tools and filter by Fetch/XHR.
- Process a Batch of Photos: Drag a batch of high-resolution images into PopiScan and watch the scanner analyze faces.
- Inspect Outbound Traffic: Observe that zero HTTP requests are dispatched. The network activity monitor remains completely blank.
- Review the Source Code: Inspect the open-source client codebase on GitHub. Every line of code running in your browser is licensed under GPLv3.