Converts raster floor plan images into layered SVGs (walls, doors, windows, stairs) using Gemini AI for element detection and potrace for vectorization.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtuvicorn viewer:app --reload --port 8001Open http://127.0.0.1:8001 in your browser.
The viewer accepts two image uploads:
-
Floor Plan Image (required) — The black-and-white floor plan to vectorize. This is the image that gets processed through the pipeline.
-
Reference Image (optional) — A point cloud or other visual reference displayed underneath the generated SVG layers as a background. This image is not processed by the pipeline in any way; it is purely a visual overlay for the end user.
The reference image must be prepared carefully so it aligns correctly with the generated SVG:
- No background. The reference image should have its background removed (or be on a transparent/white background). A dark or cluttered background will obscure the SVG layers drawn on top.
- Matching scale. The reference image must be scaled to match the floor plan input. Both images should represent the same physical area at the same pixel-per-meter ratio so walls, doors, and other elements line up when overlaid.
- Matching proportions. The aspect ratio of the reference image should match the floor plan. If the floor plan is 1200x1000 px, the reference should have the same proportions — otherwise the overlay will appear stretched or misaligned.
- Matching orientation. Ensure the reference image is rotated/flipped to match the floor plan's orientation (north-up, etc.).
- Element detection — Gemini vision identifies which layers are present (walls, doors, windows, stairs)
- Layer generation — Gemini generates a separate image for each detected layer
- Preprocessing — OpenCV cleans and refines each layer mask
- Vectorization — Potrace converts each mask into SVG paths
- Composition — All layers are composed into a single layered SVG
Requires a GEMINI_API_KEY in a .env file at the project root.