start
This commit is contained in:
1 parent
6a056262a8
commit
a55dca5fb6
11 files changed
+132
-25
No files matched your search
@@ -24,7 +24,7 @@ from skimage.morphology import disk
|
||||
|
||||
from .classify import PALETTE
|
||||
from .coords import SLICE, chunk_for_world, chunk_name
|
||||
from .inpaint import RebuildStats, fill_nearest, is_thin, rebuild
|
||||
from .inpaint import RebuildStats, add_buildings, fill_nearest, is_thin, rebuild
|
||||
|
||||
KINDS = ("text_white", "text_red", "marker", "symbol", "street_name", "region")
|
||||
MARGIN = {"text_white": 7, "text_red": 7, "marker": 3, "symbol": 4, "street_name": 1, "region": 0}
|
||||
@@ -406,7 +406,7 @@ def remove_annotations(mosaic: np.ndarray, labels: np.ndarray, annotations: Anno
|
||||
owners.setdefault(int(cid), entry)
|
||||
touched.append(ids)
|
||||
|
||||
generated = []
|
||||
generated, rebuilt = [], []
|
||||
h, w = labels.shape
|
||||
for cid, sl in enumerate(ndi.find_objects(components), start=1):
|
||||
if sl is None:
|
||||
@@ -419,9 +419,17 @@ def remove_annotations(mosaic: np.ndarray, labels: np.ndarray, annotations: Anno
|
||||
continue
|
||||
mask = np.zeros(labels.shape, dtype=bool)
|
||||
mask[sl] = piece
|
||||
result = rebuild(labels, mask, union)
|
||||
result = rebuild(labels, mask, union, add=False)
|
||||
owner = owners[cid]
|
||||
owner.stats = result.stats if owner.stats is None else _merged(owner.stats, result.stats)
|
||||
rebuilt.append((cid, sl))
|
||||
# Ergänzt wird erst, wenn alle Masken aufgebaut sind: sonst zählten Buchstabenkonturen noch nicht
|
||||
# aufgebauter Masken als Straße und teilten Blöcke, und das Ergebnis hinge von der Reihenfolge ab.
|
||||
for cid, sl in rebuilt:
|
||||
mask = np.zeros(labels.shape, dtype=bool)
|
||||
mask[sl] = components[sl] == cid
|
||||
result = add_buildings(labels, mask, union)
|
||||
owners[cid].stats = _merged(owners[cid].stats, result.stats)
|
||||
generated += [Polygon([(SLICE["x0"] + c, SLICE["y1"] - r) for r, c in corners])
|
||||
for corners in result.buildings]
|
||||
for entry, ids in zip(entries, touched):
|
||||
|
||||
Reference in new issue
Block a user