Created
October 21, 2019 08:50
-
-
Save egglang/8403d0ff1b2b6e20727b8aa971e17e03 to your computer and use it in GitHub Desktop.
G-Bowl Image marger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import cv2 | |
import numpy as np | |
from PIL import Image | |
fn = sorted(glob.glob('./wk/3/*.PNG')) | |
print(fn) | |
l = len(fn) | |
k = 0 | |
for i in range(2): | |
for j in range(3): | |
if k >= l: break | |
_im = Image.open(fn[k]) | |
_im = _im.crop((0, 40, 750, 1334 - 90)) | |
im = np.array(_im) | |
if j == 0: | |
im1 = im | |
else: | |
im1 = np.hstack((im1, im)) | |
k += 1 | |
if i == 0: | |
im2 = im1 | |
else: | |
im2 = np.vstack((im2, im1)) | |
if k >= l: break | |
im2 = cv2.cvtColor(im2, cv2.COLOR_BGR2RGB) | |
im2 = cv2.resize(im2, (900, 963)) | |
cv2.imwrite('./c.jpg', im2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment