in datasets/data_utils.py [0:0]
def generate_images_from_coords(NPX, NP, C, cols):
images = list()
for c in range(C.shape[2]):
img = Image.new("RGB", (NPX, NPX), white)
for p in range(NP - 1):
if (C[0, p + 1, c] != C[0, p, c]) or (C[1, p + 1, c] != C[1, p, c]):
draw_line(
img,
(C[0, p + 1, c], C[1, p + 1, c]),
(C[0, p, c], C[1, p, c]),
cols[c],
)
draw_line(
img,
(C[0, p, c], C[1, p, c]),
(C[0, p + 1, c], C[1, p + 1, c]),
cols[c],
)
if (C[0, p + 1, c] != C[0, 0, c]) or (C[1, p + 1, c] != C[1, 0, c]):
draw_line(
img, (C[0, p + 1, c], C[1, p + 1, c]), (C[0, 0, c], C[1, 0, c]), cols[c]
)
draw_line(
img, (C[0, 0, c], C[1, 0, c]), (C[0, p + 1, c], C[1, p + 1, c]), cols[c]
)
images.append(np.array(img))
return images