figure out a novel approach to solve the problem of floorplan analysis to calculate the…
- User
figure out a novel approach to solve the problem of floorplan analysis to calculate the gross floor area and finding the polygonal outlinew of the exterior extent of the building
Assistant
Of course. Here is a novel approach to floorplan analysis for calculating Gross Floor Area (GFA) and finding the exterior polygonal outline.
This approach moves away from traditional pure raster-based image processing (like morphological operations and simple contour detection) and instead frames the problem as one of structural deconstruction and graph-based reasoning.
The Novel Approach: Structural Graph Traversal using Physics-Informed Heuristics
The core philosophy is to stop treating the floorplan as a flat image of pixels and start treating it as a 2D projection of a physical, architecturally-sound structure. The model should first identify architectural primitives and then use their relationships (the graph) to deduce the building's exterior.
The Four-Phase Process
Here's a breakdown of the methodology:
Phase 1: Primitive Detection and Vectorization (The "Eyes")
Instead of a simple semantic segmentation (labeling every pixel as 'wall' or 'space'), this phase uses a more sophisticated instance segmentation and object detection model (like a Vision Transformer-based model, e.g., DETR, or an advanced YOLO version).
-
Multi-Class Primitive Detection: The model is trained to detect and classify specific architectural primitives not as pixel blobs, but as distinct objects with bounding boxes and vector properties:
- Wall Segments: Each straight wall piece is identified. The model outputs its endpoints, thickness, and a confidence score.
- Junctions: Critical points where walls meet are explicitly detected (L-corners, T-junctions, X-intersections).
- Openings: Doors and windows are detected as special types of objects that interrupt walls.
- Annotations: A parallel OCR (Optical Character Recognition) model reads text, specifically focusing on dimension lines (e.g., "10'-6"") and room labels ("Balcony," "Patio," "Garage").
-
Vectorization: The output isn't a pixel mask, but a list of structured data. For example:
wall_1: {start: [x1, y1], end: [x2, y2], thickness: 15px}junction_1: {type: 'T', pos: [x3, y3]}dimension_1: {text: "12m", pixel_length: 400px}
This initial step immediately converts the noisy raster image into a clean, structured vector format, which is the foundation for all subsequent reasoning.
Phase 2: Graph Construction (The "Brain")
The vectorized primitives from Phase 1 are used to construct a relational graph
G = (V, E), where:- Vertices (V): These are the Junctions detected in Phase 1. Each vertex stores its coordinates and junction type.
- Edges (E): These are the Wall Segments. An edge connects two vertices (junctions) and has attributes:
length: The geometric length of the wall segment.thickness: The wall thickness.type: 'solid_wall', 'window', 'door'.
This graph now represents the structural skeleton of the building. Internal clutter, furniture, and text are naturally excluded because they don't form part of this wall-and-junction graph.
Phase 3: Exterior Outline Discovery (The "Pathfinder")
This is the most novel part. Finding the exterior outline is now a graph traversal problem, not a pixel-based one. We use a "Shrink-Wrap" or "Outside-In" traversal algorithm.
-
Seed Point Selection: Identify a starting vertex on the graph that is guaranteed to be part of the exterior. The most reliable method is to find the vertex on the convex hull of all vertices in the graph. Let's call this
V_start. -
Physics-Informed Traversal: Starting from
V_start, the algorithm traverses from vertex to vertex to trace the outline. At each vertex (junction), it must decide which edge to follow next. The key heuristic is: always take the "outermost" turn.- Imagine standing at the current vertex
V_curr, having arrived fromV_prev. - You calculate the angles of all outgoing edges relative to the incoming edge
(V_curr - V_prev). - For a clockwise traversal, you would always choose the edge with the smallest positive angle (the "sharpest right turn" possible without turning back on yourself). For a counter-clockwise traversal, you'd choose the largest angle (the "sharpest left turn").
- This mimics the physical process of walking around the outside of a building. You would never turn into the building; you would always follow the exterior face.
- Imagine standing at the current vertex
-
Handling Architectural Features:
- Balconies/Recesses: This algorithm naturally handles concave shapes and recesses, as it simply follows the connected wall graph. The definition of "outermost" remains consistent.
- Openings: If the traversal encounters an edge representing a large opening (like a garage door or a wall-less patio connection), it can use the room label annotations from Phase 1. If the adjacent space is labeled "Exterior," "Patio," or "Balcony," the GFA rules can be applied correctly (e.g., including or excluding it from the final calculation).
The output of this phase is an ordered list of vertices that define the exterior polygonal outline.
Phase 4: GFA Calculation and Refinement
-
Scale Determination: Using the OCR'd dimension lines from Phase 1, the system establishes a robust scale. It can average the pixels-per-meter/foot ratio from multiple dimension lines across the plan to get a highly accurate conversion factor, mitigating errors from any single incorrect reading.
-
Polygon Area Calculation: With the ordered list of exterior vertices and the scale, the GFA is calculated using the Shoelace Formula (Surveyor's Formula). This is a mathematically precise method for finding the area of a polygon given the coordinates of its vertices.
-
Final Polygon: The ordered list of vertices is the polygonal outline of the building's exterior extent. It's not an approximation from a pixel contour but a precise geometric shape derived from the building's core structure.
Why This Approach is Novel and Superior
- Robustness to Noise: By vectorizing primitives first, the system is highly resistant to image quality issues like JPEG artifacts, varying line thicknesses, and text overlapping walls. It's looking for structure, not perfect pixels.
- Semantic Understanding: The graph model understands that a "wall" connects two "junctions." This is a massive leap over pixel-based methods that see a wall as just a line of dark pixels. This allows for error correction (e.g., identifying a wall segment that doesn't connect to two junctions as a potential detection error).
- Eliminates Heuristic Image Processing: It replaces fragile, parameter-sensitive steps like morphological opening/closing and thresholding with a robust graph traversal algorithm.
- Accuracy and Precision: The final area calculation is based on a precise polygon and a well-calibrated scale, not on pixel counting, leading to higher accuracy.
- Extensibility: This model can be easily extended. For example, to calculate Net Floor Area, one could run an internal traversal algorithm to identify individual room polygons within the main graph. The graph could also be used to analyze room adjacency or circulation paths.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.