I am trying to extract building footprints from a raster map (as shown in the example below). Please note that the maps are out of copyright, have been scanned and georectified by a library and have been provided to me for exactly this purpose.
So far I have been using the NYPL Map-Vectorizer which works by first adjusting the brightness/contrast of the image, then setting a colour threshold to extract a black and white image, which in turn is processed using gdal_polygonize.py (followed by some simplification and removal of roads).
The issue is that this gives polygons of the inside of the building. Terrace buildings end up with a gap between them.
How can I post-process to remove the gap between the terrace buildings? Is there an altogether better method for extracting building footprints from this map?
Note: Solutions need to be able to run as a script. I'm able to test proposed techniques in QGIS.