Commit b5ac5aa0 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

ENH: New tentative for tiled vectorization.

parent 03e70183
No related merge requests found
Showing with 11 additions and 2 deletions
+11 -2
......@@ -232,12 +232,21 @@ def tiled_vectorization(input_segm, nominal_tile_size, output_template):
tx, ty = int(arr.shape[1] / nominal_tile_size[0]) + 1, int(arr.shape[0] / nominal_tile_size[1]) + 1
obj_to_tile = dict.fromkeys(range(tx*ty), [])
obj_to_tile = dict.fromkeys(range(tx*ty))
for i in range(tx*ty):
obj_to_tile[i] = []
for o in rp:
idx = int(o.bbox[1] / nominal_tile_size[0]) * ty + int(o.bbox[0] / nominal_tile_size[1])
ix, iy = int(o.bbox[1] / nominal_tile_size[0]), int(o.bbox[0] / nominal_tile_size[1])
idx = ix * ty + iy
obj_to_tile[idx].append(o.label)
import matplotlib.pyplot as plt
for i in range(tx*ty):
test = np.isin(arr, np.array(obj_to_tile[i]))
plt.figure()
plt.imshow(test)
return obj_to_tile
def get_bounding_boxes(input_segm):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment