1

enter image description here


the original base file is dxf type floorplan.
above picture is result of layer filtering processing.

i want to using OpenCV but there is some problem.

enter image description here

is there any way to fill first picture like second image?
i don't have idea how to flood filling with open rectangle...

Community
  • 1
  • 1
Bro K
  • 43
  • 7
  • You want to fill the walls, right? The problem is that some of the contours are not closed, so flood filling will expand the filling color out of those contours into the background... – stateMachine Oct 26 '20 at 02:53
  • @eldesgraciado yes, that is problem.. now i finding closing blocks per contours.. – Bro K Oct 26 '20 at 03:02
  • 1
    I suggest you divide the problem in 2 steps: 1) Close the contours and 2) Fill the them via the Flood-fill algorithm. Now, I think the challenge lies in closing those opened contours, here are some suggestions: Notice how these contours are not closed by a line, and generally have 2 endpoints. Try to locate these. Maybe via a hit-or-miss operation, with a special kernel to locate them. Next, join them. Given an endpoint, search in a window (or neighborhood) for the closest endpoint. Join those two with a straight line. After this, filling the walls should be pretty straightforward. – stateMachine Oct 26 '20 at 03:49
  • @eldesgraciado its good idea! I think this procedure like 'divide and Conquer'. I will try it now. thx for helping ! – Bro K Oct 26 '20 at 04:22

0 Answers0