Filling hatched areas in image I'm trying to extract / fill the walls in a floor plan, the walls are filled with a (cross-)hatch pattern at a more or less fixed angle.

I've managed to remove most of the "noise" by masking the DFT so I have both the +45 deg lines and -45deg lines in separate images.

The boundaries of the walls are quite obvious to the human observer but somehow I'm stuck at segementing those lines into groups, i.e connected components. 

What I could think of is to apply a run-length encoding and then looking for subvectors of length 4 which fullfill a certain ratio of black and white. Or a cross-correlation of a pre-defined hatching pattern. The issue I have with these methods is that I'd have to introduce a parameter which has to be tuned for every floor plan, this is what I want to avoid.

So I'm asking you guys whether you could give me some input how to approach this problem.
As mentioned in another answer, image erosion is quite efficient to fill the gaps between the wall hatched lines. The key point is to choose a structure element that is big enough to allow connection to be done.

You should use a structure element with both horizontal and vertical dimensions of at least half the distance between hatched lines (try different values!). You may end with a final erosion with a small structure element to remove remaining noise (the thin and lonely lines in your case).

Then it is your responsibility to detect and refine the borders ;)

Here is attached the result I obtained with a square structure element of 19x19 pixels on a sample of the image you linked (logical OR one) assuming that the distance between lines is 19 pixels:



Hint: The output is smoother with a larger structure element but artefacts appear at the corners.