Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # tile images
- import cv2
- import numpy as np
- tile_w, tile_h = int(1920/4), int(1080/3)
- tile_x, tile_y = 4, 3
- canvas = np.zeros((tile_h*tile_y, tile_w*tile_x, 3), dtype='uint8')
- for ty in range(tile_y):
- for tx in range(tile_x):
- img = cv2.imread(f'{ty*tile_x+tx + 1}.png')
- img = cv2.resize(img, (tile_w, tile_h), interpolation=cv2.INTER_AREA)
- x0, x1 = tile_w*tx, tile_w*(tx+1)
- y0, y1 = tile_h*ty, tile_h*(ty+1)
- canvas[y0:y1, x0:x1] = img
- # cv2.imshow('win', canvas)
- # cv2.waitKey(0)
- cv2.imwrite('out.png', canvas)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement