Team Ai
Apppublic

Shingome/Image_Processing

sourceHugging Faceotherupdated 2y agoView on Hugging Face
0likes
frommap.py40 linesDownload Raw Back to src
1from PIL import Image, ImageDraw2import numpy as np3 4 5step = 56width = 6007height = 6008 9width *= step10height *= step11 12image = Image.new('RGB', (width, height), (255, 255, 255))13draw = ImageDraw.Draw(image)14 15map = np.load('./../map.npy')16 17print(len(map))18 19iter = 020 21k = 822 23for x in range(0, width, step):24    for y in range(0, height, step):25        if map[iter] == 1:26            xn, yn = x, y + k27        elif map[iter] == 2:28            xn, yn = x + k, y29        elif map[iter] == 3:30            xn, yn = x + k, y - k31        elif map[iter] == 4:32            xn, yn = x + k, y + k33        else:34            iter += 135            continue36        draw.line(xy=[(x, y), (xn, yn)], fill='black')37        iter += 138 39image.show()40