Skip to content
InfiKnight-TGPPublic

About

Planora converts a floor-plan image into a scaled 3D model that you can place in AR or walk through from a web link.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Planora

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>.

Run

python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python app.py

Desktop view: http://localhost:5000

Testing AR on a phone

Camera AR requires HTTPS — localhost will not work from a phone.

ngrok http 5000

Open 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.

How it works

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

Detection: mask scanning, not Hough-on-edges

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.

Why scale gets its own UI step

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.

Measured on the bundled test plan (800×600)

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 / not verified

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.

Limitations

  • 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.

Next steps, in payoff order

  1. Test on a real phone (blocking — do this first).
  2. Room polygons → per-room floor materials.
  3. CubiCasa5k detector for non-axis-aligned and noisy plans.
  4. Furniture from icon detection (stretch).

About

Planora converts a floor-plan image into a scaled 3D model that you can place in AR or walk through from a web link.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages