Turn a floor plan into a space you can walk through, or place on your table in AR.
Built AR-first: metric throughout, GLB exported server-side, AR delivered
through <model-viewer>.
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python app.pyDesktop view: http://localhost:5000
Camera AR requires HTTPS — localhost will not work from a phone.
ngrok http 5000Open the https://… URL on your phone.
- Android (Chrome): WebXR or Scene Viewer. Works directly.
- iOS (Safari): iOS Safari does not support WebXR immersive-ar.
<model-viewer>falls back to AR Quick Look, generating USDZ on the fly. This is exactly why we don't hand-write WebXR — it is broken on iPhones.
image ──► detect.py ──► wall segments + openings, in PIXELS
│
user clicks 2 points + enters real distance
│
metres_per_pixel
│
build_model.py ───────┴──► GLB in METRES (trimesh, PBR materials)
│
<model-viewer> ──► WebXR / Scene Viewer / Quick Look
Most plans are axis-aligned, so detect.py scans the wall mask row-by-row and
column-by-column for runs of wall material. Contiguous rows with a stable
run-structure form a wall band; the runs are wall pieces and the gaps between
them are openings.
This matters: an earlier Hough-on-Canny-edges version found wall outlines, so each detected segment already stopped at a doorway — there was no gap left to find, and it detected zero openings. Scanning finds them naturally.
Openings are classified by sampling the raw (pre-morphology) mask across the wall thickness:
- gap empty in both masks → door
- gap contains thin lines (glazing) → window
Furniture is rejected by stroke thickness: walls are thick, furniture outlines are thin, so a morphological opening removes them before detection.
glTF is metres by convention and AR viewers trust that absolutely. Wrong scale is invisible in a desktop orbit view and catastrophic in AR. So the user must click two points and state a real distance — nothing is guessed.
Modes: Tabletop (1:50) sits on a desk; Life size (1:1) to walk through.
| Metric | Value |
|---|---|
| Wall pieces | 31 |
| Doors | 5 |
| Windows | 13 |
| Triangles | 912 |
| GLB size | 16.4 KB |
| Real footprint | 14.55 m × 10.91 m |
| Tabletop (1:50) size | 0.29 m × 0.22 m |
Far under the ~100k triangle mobile budget.
Verified: detection accuracy checked against a rendered debug overlay; GLB round-trips with four distinct PBR materials intact; both scale modes produce correct dimensions; implausible calibration triggers a warning; all Flask routes including 404/400 paths.
Not verified: AR launching on a physical device. No camera available in the
build environment. The <model-viewer> configuration follows documented usage,
but you must confirm on a real phone.
- Axis-aligned only. Diagonal or curved walls are missed. Your plan is axis-aligned; many are not.
- Classical CV, not ML. Swap
detect_walls()for CubiCasa5k — downstream code only depends on the returned dict shape. - No furniture, no room-type classification, no multi-floor.
- Uploads/models written to disk with no cleanup or auth. Demo-grade.
- Test on a real phone (blocking — do this first).
- Room polygons → per-room floor materials.
- CubiCasa5k detector for non-axis-aligned and noisy plans.
- Furniture from icon detection (stretch).