Skip to content

Add FloorPlan.DetectFloorPlanFromImage node for raster-to-geometry floor plan detection#100

Open
Copilot wants to merge 3 commits into
masterfrom
copilot/add-opencv-node-detect-floor-plans
Open

Add FloorPlan.DetectFloorPlanFromImage node for raster-to-geometry floor plan detection#100
Copilot wants to merge 3 commits into
masterfrom
copilot/add-opencv-node-detect-floor-plans

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

Dynamo users working with raster floor plan images (JPG scans, screenshots, exported sheets) currently have no first-party path to geometry — requiring manual tracing or custom Python. This adds a FloorPlan.DetectFloorPlanFromImage zero-touch node in Core > Geometry that runs a full image processing pipeline and returns Dynamo-native geometry as single lines representing the sketch.

New file: src/RhythmCore/Geometry/FloorPlan.cs

Processing pipeline (pure C#, System.Drawing — no native OpenCV binaries):

  • Grayscale via integer fixed-point BT.601 ((77R + 150G + 29B) >> 8)
  • 5×5 Gaussian blur denoising
  • Thresholding: Otsu automatic or adaptive local-mean (integral image, O(1) per pixel)
  • Morphological opening (erode → dilate) for speckle removal
  • Sobel edge detection
  • Standard Hough transform with peak NMS + per-line segment extraction
  • BFS flood-fill room contours with RDP polygon simplification
  • Horizontal/vertical wall-gap scan for opening detection

Inputs: imagePath, scale, threshold, adaptiveThreshold, minLineLength, detectRooms, detectOpenings, debugOutput

Outputs (MultiReturn):

Port Type Description
lines Line[] Detected sketch linework (single centerline lines)
roomBoundaries PolyCurve[] Closed room boundary candidates
openingLocations Point[] Door/window gap midpoints
report Dictionary Dimensions, threshold used, counts, processingTimeMs, warnings[]

Error handling: all failure modes (missing file, unreadable image, sub-50px resolution, zero geometry detected) surface as warnings entries rather than exceptions — node never crashes Dynamo.

Implementation notes:

  • No wallThicknessRange — the node returns single lines representing the sketch geometry, not wall thickness estimates.
  • Uses global:: aliases (SMath, SysBitmap, ImagePoint, etc.) to resolve ambiguity with the existing Rhythm.System and Rhythm.Math namespaces in the project.
  • Large images (>1500px) are downsampled before the Hough accumulator pass to keep processing bounded.
  • No native binary deployment concern: System.Drawing is already available via UseWindowsForms=true across all target frameworks (net48 for R20–R24, net7/net8-windows for R25–R27).

…al floor plans from images

Agent-Logs-Url: https://github.com/johnpierson/RhythmForDynamo/sessions/aea88a73-d51f-4e41-a4b9-f98503c05607

Co-authored-by: johnpierson <15744724+johnpierson@users.noreply.github.com>
Copilot AI changed the title [WIP] Add OpenCV node for detecting architectural floor plans from JPG images Add FloorPlan.DetectFloorPlanFromImage node for raster-to-geometry floor plan detection May 6, 2026
Copilot AI requested a review from johnpierson May 6, 2026 04:52
@johnpierson johnpierson marked this pull request as ready for review May 6, 2026 04:53
@johnpierson
Copy link
Copy Markdown
Owner

@copilot, no need for wall thickness estimation, we just want single lines that represent the sketch

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot, no need for wall thickness estimation, we just want single lines that represent the sketch

Removed the wallThicknessRange parameter in bfa8149. The node now only returns single Line geometry from Hough line detection — no wall thickness estimation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OpenCV node for detecting architectural floor plans from JPG images

2 participants